Files
swift-mirror/test/NameBinding/library.swift
Dmitri Hrybenko 3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00

46 lines
1.1 KiB
Swift

// RUN: %target-swift-frontend -parse %s -I %S/Inputs -enable-source-import -parse-as-library -verify
// Name lookup is global in a library.
var x : x_ty = 4
typealias x_ty = Int
// Name lookup is global in a library.
// This case requires doing semantic analysis (conversion checking) after
// parsing.
var y : y_ty = 4
typealias y_ty = (Int)
// Verify that never-defined types are caught.
var z : z_ty = 42 // expected-error {{use of undeclared type 'z_ty'}}
// Make sure we type-check all declarations before any initializers
var a : Int = b
var b : Int = 1
var c = 1
var d = 2
var e = 3
// Name-binding with imports
import imported_module
func over1(x: UInt64) {} // expected-note{{found this candidate}}
func over2(x: UInt32) {}
func over3(x: UInt32) {}
typealias over4 = UInt32
func testover() {
// FIXME: Very weird diagnostic here.
over1(0) // expected-error{{ambiguous use of 'over1'}}
over2(0)
over3(0) // FIXME: Should we produce an ambiguity error here?
var x : over4 = 10
}
// Referring to name within a module.
var d2 : Swift.Int = 5
var y2 : library.y_ty = 5
func increment_y2() {
y2 = library.y2 + 1
}