Files
swift-mirror/test/Serialization/top-level-code.swift
John McCall 7815892a76 Add unique typo corrections to the main diagnostic with a fix-it.
Continue to emit notes for the candidates, but use different text.
Note that we can emit a typo correction fix-it even if there are
multiple candidates with the same name.

Also, disable typo correction in the migrator, since the operation
is quite expensive, the notes are never presented to the user, and
the fix-its can interfere with the migrator's own edits.

Our general guidance is that fix-its should be added on the main
diagnostic only when the fix-it is highly likely to be correct.
The exact threshold is debateable.  Typo correction is certainly
capable of making mistakes, but most of its edits are right, and
when it's wrong it's usually obviously wrong.  On balance, I think
this is the right thing to do.  For what it's worth, it's also
what we do in Clang.
2018-04-07 16:01:39 -04:00

14 lines
427 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -emit-module -o %t %s -module-name Test
// RUN: llvm-bcanalyzer %t/Test.swiftmodule | %FileCheck %s
// RUN: cp %s %t/main.swift
// RUN: %target-swift-frontend -typecheck -verify %t/main.swift -primary-file %S/Inputs/top-level-code-other.swift
// CHECK-NOT: UnknownCode
let a: Int? = 1 // expected-note {{'a' declared here}}
guard let b = a else {
fatalError()
}