|
1 |
| -// RUN: %target-swift-frontend -parse-stdlib -enable-experimental-move-only -module-name main -enable-sil-opaque-values -parse-as-library -emit-sil -Onone %s | %FileCheck %s |
| 1 | +// RUN: %target-swift-frontend -parse-stdlib -enable-experimental-move-only -module-name Swift -enable-sil-opaque-values -parse-as-library -emit-sil -Onone %s | %FileCheck %s |
2 | 2 |
|
3 | 3 | // Like opaque_values_Onone.swift but for code that needs to be compiled with
|
4 | 4 | // -parse-stdlib.
|
5 | 5 |
|
6 |
| -class X {} |
| 6 | +precedencegroup AssignmentPrecedence { assignment: true } |
| 7 | +precedencegroup CastingPrecedence {} |
| 8 | + |
| 9 | +public protocol _ObjectiveCBridgeable {} |
| 10 | + |
| 11 | +public protocol _ExpressibleByBuiltinBooleanLiteral { |
| 12 | + init(_builtinBooleanLiteral value: Builtin.Int1) |
| 13 | +} |
| 14 | +struct Bool : _ExpressibleByBuiltinBooleanLiteral { |
| 15 | + var _value: Builtin.Int1 |
| 16 | + @_silgen_name("Bool_init_noargs") |
| 17 | + init() |
| 18 | + init(_ v: Builtin.Int1) { self._value = v } |
| 19 | + init(_ value: Bool) { self = value } |
| 20 | + init(_builtinBooleanLiteral value: Builtin.Int1) { |
| 21 | + self._value = value |
| 22 | + } |
| 23 | +} |
7 | 24 |
|
| 25 | +@_silgen_name("typeof") |
| 26 | +@_semantics("typechecker.type(of:)") |
| 27 | +public func type<T, Metatype>(of value: T) -> Metatype |
| 28 | + |
| 29 | +class X {} |
8 | 30 | func consume(_ x : __owned X) {}
|
9 | 31 |
|
10 | 32 | func foo(@_noImplicitCopy _ x: __owned X) {
|
@@ -70,3 +92,8 @@ func toObject<T>(_ object: inout T) -> Builtin.BridgeObject {
|
70 | 92 | func getAnotherType<T, U>(_ object: inout T, to ty: U.Type) -> U {
|
71 | 93 | Builtin.reinterpretCast(object)
|
72 | 94 | }
|
| 95 | + |
| 96 | +@_silgen_name("isOfTypeOfAnyObjectType") |
| 97 | +func isOfTypeOfAnyObjectType(fromAny any: Any) -> Bool { |
| 98 | + type(of: any) is Builtin.AnyObject.Type |
| 99 | +} |
0 commit comments