Skip to content

Commit

Permalink
Don't treat missing imports as an error when -debugger-support is on.
Browse files Browse the repository at this point in the history
For now, also check that -playground is off; once <rdar://problem/18090611>
is in we can drop this check and treat them as mostly orthogonal options.

Part of <rdar://problem/17994094>

Swift SVN r21385
  • Loading branch information
jrose-apple committed Aug 21, 2014
1 parent 9b0d643 commit 9d2e2cb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/Sema/NameBinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,10 @@ NameBinder::addImport(SmallVectorImpl<std::pair<ImportedModule, bool>> &imports,
[&] { modulePathStr += "."; });

auto diagKind = diag::sema_no_import;
if (SF.Kind == SourceFileKind::REPL)
if (SF.Kind == SourceFileKind::REPL ||
(Context.LangOpts.DebuggerSupport && !Context.LangOpts.Playground)) {
diagKind = diag::sema_no_import_repl;
}
diagnose(ID->getLoc(), diagKind, modulePathStr);

if (Context.SearchPathOpts.SDKPath.empty()) {
Expand Down
4 changes: 4 additions & 0 deletions test/Parse/debugger.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// RUN: %swift %s -verify -debugger-support

import Nonexistent_Module // expected-error {{no such module}}

var ($x0, $x1) = (4, 3)
var z = $x0 + $x1

z // no error.

var x: Double = z // expected-error {{'Int' is not convertible to 'Double'}}
9 changes: 7 additions & 2 deletions test/PlaygroundTransform/declarations_error.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
// RUN: rm -rf %t && mkdir %t
// RUN: cp %s %t/main.swift
// RUN: %swift -parse -playground %t/main.swift -verify
var $a = 2 // expected-error {{expected numeric value following '$'}}
// RUN: not %swift -parse -playground %t/main.swift 2>&1 | FileCheck %s
// RUN: not %swift -parse -playground -debugger-support %t/main.swift 2>&1 | FileCheck %s

// CHECK: error: no such module
import Nonexistent_Module
// CHECK-NOT: error
import Another_Nonexistent_Module
4 changes: 4 additions & 0 deletions test/PlaygroundTransform/import_error.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// RUN: rm -rf %t && mkdir %t
// RUN: cp %s %t/main.swift
// RUN: %swift -parse -playground %t/main.swift -verify
var $a = 2 // expected-error {{expected numeric value following '$'}}

0 comments on commit 9d2e2cb

Please sign in to comment.