Files
swift-mirror/test/APINotes/basic.swift
Doug Gregor 55a3f5398c [Clang importer] Import Swift 2 "stubs" to improve errors in "Swift 2" code.
When attempting to compile Swift 2 code (or any Swift code using the
Swift 2 names) in Swift 3, the compiler diagnostics are often entirely
useless because the names have changed radically enough that one
generally gets "no member named 'foo'" errors rather than a helpful
"'foo' was renamed to 'bar'" error. This makes for a very poor user
experience when (e.g.) trying to move Swift 2 code forward to Swift 3.

To improve the experience, when the Swift 2 and Swift 3 names of an
API differ, the Clang importer will produce a "stub" declaration that
matches the Swift 2 API. That stub will be marked with a synthesized
attribute

  @available(unavailable, renamed: "the-swift-3-name")

that enables better diagnostics (e.g., "'foo' is unavailable: renamed
to 'bar') along with Fix-Its (courtesy of @jrose-apple's recent work)
that fix the Swift 2 code to compile in Swift 3.

This change addresses much of rdar://problem/25309323 (concerning QoI
of Swift 2 code compiled with a Swift 3 compiler), but some cleanup
remains.
2016-05-06 21:12:20 -07:00

21 lines
695 B
Swift

// RUN: %target-parse-verify-swift -I %S/Inputs/custom-modules
import APINotesTest
func testSwiftName() {
moveTo(x: 0, y: 0, z: 0)
moveTo(0, 0, 0) // expected-error{{missing argument labels 'x:y:z:' in call}}
_ = global
_ = ANTGlobalValue // expected-error{{'ANTGlobalValue' has been renamed to 'global'}}
let ps = Point(x: 0.0, y: 0.0)
let ps2 = PointStruct(x: 0.0, y: 0.0) // expected-error{{'PointStruct' has been renamed to 'Point'}}
let r: Real = 0.0
let r2: real_t = 0.0 // expected-error{{'real_t' has been renamed to 'Real'}}
let rect: Rect
let rect2: RectStruct // expected-error{{'RectStruct' has been renamed to 'Rect'}}
let d: Double = __will_be_private
}