Files
swift-mirror/test/Parse/diagnostic_points_to_first_bad_token.swift
Dmitri Hrybenko 9bbfe27615 Add an option for diagnostics -- PointsToFirstBadToken
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
2013-09-05 23:38:32 +00:00

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: {{^}} ^{{$}}