Skip to content

Commit c8134db

Browse files
committed
[embedded] Add metatypes.swift test showing a diagnostic when using metatypes
1 parent db10e78 commit c8134db

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/embedded/metatypes.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: %target-swift-emit-ir -verify %s -enable-experimental-feature Embedded -wmo
2+
3+
// REQUIRES: optimized_stdlib
4+
// REQUIRES: VENDOR=apple
5+
// REQUIRES: OS=macosx
6+
7+
public func sink<T>(t: T) {}
8+
9+
public func test() -> Int {
10+
let metatype = Int.self
11+
sink(t: metatype) // expected-error {{cannot use metatype 'Int' in embedded Swift}}
12+
// expected-note@-1 {{called from here}}
13+
return 42
14+
}

0 commit comments

Comments
 (0)