mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Diagnostics that point to the first bad token are marked with this option in Diagnostics.def. Parser::diagnose treats the source location of such diagnostics in a special way: if source location points to a token at the beginning of the line, then it moves the diagnostic to the end of the previous token. This behaviour improves experience for "expected token X" diagnostics. Swift SVN r7965
17 lines
573 B
Swift
17 lines
573 B
Swift
// RUN: not %swift -parse %s 2>&1 | FileCheck -strict-whitespace %s
|
|
|
|
// Test the diagnostic option 'PointsToFirstBadToken'.
|
|
|
|
typealias TestDiagPointsToEndOfLine =
|
|
|
|
// CHECK: error: expected type in typealias declaration
|
|
// CHECK-NEXT: {{^}}typealias TestDiagPointsToEndOfLine ={{$}}
|
|
// CHECK-NEXT: {{^}} ^{{$}}
|
|
|
|
typealias TestDiagPointsToBadToken = =
|
|
|
|
// CHECK: error: expected type in typealias declaration
|
|
// CHECK-NEXT: {{^}}typealias TestDiagPointsToBadToken = ={{$}}
|
|
// CHECK-NEXT: {{^}} ^{{$}}
|
|
|