Files
swift-mirror/test/SourceKit/Misc/strange_interpolation.swift
Brent Royal-Gordon a4e5bcea6a Move strange interpolation fix to PreCheckExpression
This defers diagnosis until a stage where #if conditions have definitely been evaluated, at the cost of a slightly more complex implementation. We’ll gain some of that complexity back in a subsequent refactoring. Fixes SR-9937.
2019-05-09 15:29:21 -07:00

20 lines
630 B
Swift

// Parse-only modes, like swift -parse and SourceKit, should not emit strange
// interpolation errors in `#if swift(>=5)` blocks. (SR-9937)
//
// Even though this is in the test/SourceKit directory, it also tests
// -frontend -parse behavior because the test cases are exactly the same.
// RUN: %sourcekitd-test -req=open %s -- -swift-version 4.2 %s == -req=print-diags %s | %FileCheck %s
// RUN: %target-swift-frontend -parse -verify -swift-version 4.2 %s
let x = 1
// We should not warn in blocks that can only run when `swift(>=5.0)`.
#if swift(>=5.0)
print("[\(foo: x)]")
print("[\(x, x)]")
#endif
// CHECK: <<NULL>>