mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Implement more reasonable local value name lookup:
- Allow forward references. - Diagnose redefinitions. - Diagnose cases where the use/def of a value mismatch type. While I'm at it, this fixes a bug where tuple parsing wasn't parsing the separating commas. Swift SVN r5343
This commit is contained in:
@@ -1,17 +1,37 @@
|
||||
// RUN: %swift %s -emit-sil | FileCheck %s
|
||||
|
||||
// CHECK: sil clang_thunk @prototype : $() -> ()
|
||||
sil clang_thunk @prototype : $() -> ()
|
||||
var dummy : Int
|
||||
|
||||
// Linkage types.
|
||||
|
||||
// CHECK: sil clang_thunk @clang_thunk : $() -> ()
|
||||
sil clang_thunk @clang_thunk : $() -> ()
|
||||
|
||||
// CHECK: sil internal @internal_fn : $() -> Int
|
||||
sil internal @internal_fn : $() -> Int
|
||||
|
||||
// Type references
|
||||
|
||||
// Some cyclic type references between SIL function bodies.
|
||||
class Class1 { var a : Class2 }
|
||||
class Class2 { var b : Class1 }
|
||||
|
||||
sil @test2 : $(a : Class1) -> () { // CHECK: sil @test2 : $(a : Class1) -> ()
|
||||
sil @type_ref1 : $(a : Class1, b : Int) -> () // CHECK: $(a : Class1, b : Int64)
|
||||
|
||||
|
||||
// Instructions
|
||||
|
||||
sil @test1 : $() -> () { // CHECK: sil @test1 : $() -> ()
|
||||
bb0: // CHECK: bb0:
|
||||
%0 = tuple () // CHECK: %0 = tuple ()
|
||||
%1 = return %0 : $() // CHECK: %1 = return %0 : $()
|
||||
}
|
||||
|
||||
// CHECK: sil internal @internal_fn : $() -> Int
|
||||
sil internal @internal_fn : $() -> Int
|
||||
// Forward referenced values.
|
||||
// TODO: Use control flow to avoid building incorrect SSA.
|
||||
sil @test2 : $() -> () { // CHECK: sil @test2 : $() -> ()
|
||||
bb0: // CHECK: bb0:
|
||||
%1 = return %0 : $() // CHECK: %0 = return %1 : $()
|
||||
%0 = tuple () // CHECK: %1 = tuple ()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user