mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Rework ASTDumper (#68438)
This PR refactors the ASTDumper to make it more structured, less mistake-prone, and more amenable to future changes. For example:
```cpp
// Before:
void visitUnresolvedDotExpr(UnresolvedDotExpr *E) {
printCommon(E, "unresolved_dot_expr")
<< " field '" << E->getName() << "'";
PrintWithColorRAII(OS, ExprModifierColor)
<< " function_ref=" << getFunctionRefKindStr(E->getFunctionRefKind());
if (E->getBase()) {
OS << '\n';
printRec(E->getBase());
}
PrintWithColorRAII(OS, ParenthesisColor) << ')';
}
// After:
void visitUnresolvedDotExpr(UnresolvedDotExpr *E, StringRef label) {
printCommon(E, "unresolved_dot_expr", label);
printFieldQuoted(E->getName(), "field");
printField(E->getFunctionRefKind(), "function_ref", ExprModifierColor);
if (E->getBase()) {
printRec(E->getBase());
}
printFoot();
}
```
* Values are printed through calls to base class methods, rather than direct access to the underlying `raw_ostream`.
* These methods tend to reduce the chances of bugs like missing/extra spaces or newlines, too much/too little indentation, etc.
* More values are quoted, and unprintable/non-ASCII characters in quoted values are escaped before printing.
* Infrastructure to label child nodes now exists.
* Some weird breaks from the normal "style", like `PatternBindingDecl`'s original and processed initializers, have been brought into line.
* Some types that previously used ad-hoc dumping functions, like conformances and substitution maps, are now structured similarly to the dumper classes.
* I've fixed the odd dumping bug along the way. For example, distributed actors were only marked `actor`, not `distributed actor`.
This PR doesn't change the overall style of AST dumps; they're still pseudo-S-expressions. But the logic that implements this style is now isolated into a relatively small base class, making it feasible to introduce e.g. JSON dumping in the future.
This commit is contained in:
committed by
GitHub
parent
51c676c614
commit
8770c7f826
@@ -1118,6 +1118,9 @@ public:
|
||||
#include "swift/AST/TokenKinds.def"
|
||||
};
|
||||
|
||||
static StringRef
|
||||
getLiteralKindPlainName(ObjectLiteralExpr::LiteralKind kind);
|
||||
|
||||
private:
|
||||
ArgumentList *ArgList;
|
||||
SourceLoc PoundLoc;
|
||||
|
||||
@@ -203,8 +203,6 @@ enum class ReadImplKind {
|
||||
};
|
||||
enum { NumReadImplKindBits = 4 };
|
||||
|
||||
StringRef getReadImplKindName(ReadImplKind kind);
|
||||
|
||||
/// How are simple write accesses implemented?
|
||||
enum class WriteImplKind {
|
||||
/// It's immutable.
|
||||
@@ -231,8 +229,6 @@ enum class WriteImplKind {
|
||||
};
|
||||
enum { NumWriteImplKindBits = 4 };
|
||||
|
||||
StringRef getWriteImplKindName(WriteImplKind kind);
|
||||
|
||||
/// How are read-write accesses implemented?
|
||||
enum class ReadWriteImplKind {
|
||||
/// It's immutable.
|
||||
@@ -258,8 +254,6 @@ enum class ReadWriteImplKind {
|
||||
};
|
||||
enum { NumReadWriteImplKindBits = 4 };
|
||||
|
||||
StringRef getReadWriteImplKindName(ReadWriteImplKind kind);
|
||||
|
||||
class StorageImplInfo {
|
||||
using IntType = uint16_t;
|
||||
static_assert(NumReadImplKindBits + NumWriteImplKindBits
|
||||
|
||||
@@ -189,6 +189,7 @@ public:
|
||||
void print(raw_ostream &OS, const PrintOptions &Opts = PrintOptions()) const;
|
||||
void print(ASTPrinter &Printer, const PrintOptions &Opts) const;
|
||||
SWIFT_DEBUG_DUMP;
|
||||
void dump(raw_ostream &OS, unsigned indent = 0) const;
|
||||
};
|
||||
|
||||
/// A TypeRepr for a type with a syntax error. Can be used both as a
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1222,14 +1222,19 @@ StringRef ObjectLiteralExpr::getLiteralKindRawName() const {
|
||||
llvm_unreachable("unspecified literal");
|
||||
}
|
||||
|
||||
StringRef ObjectLiteralExpr::getLiteralKindPlainName() const {
|
||||
switch (getLiteralKind()) {
|
||||
StringRef ObjectLiteralExpr::
|
||||
getLiteralKindPlainName(ObjectLiteralExpr::LiteralKind kind) {
|
||||
switch (kind) {
|
||||
#define POUND_OBJECT_LITERAL(Name, Desc, Proto) case Name: return Desc;
|
||||
#include "swift/AST/TokenKinds.def"
|
||||
}
|
||||
llvm_unreachable("unspecified literal");
|
||||
}
|
||||
|
||||
StringRef ObjectLiteralExpr::getLiteralKindPlainName() const {
|
||||
return ObjectLiteralExpr::getLiteralKindPlainName(getLiteralKind());
|
||||
}
|
||||
|
||||
ConstructorDecl *OtherConstructorDeclRefExpr::getDecl() const {
|
||||
return cast_or_null<ConstructorDecl>(Ctor.getDecl());
|
||||
}
|
||||
|
||||
@@ -2,37 +2,37 @@
|
||||
|
||||
// expected-warning @+1 {{'@differentiable' has been renamed to '@differentiable(reverse)'}} {{23-23=(reverse)}}
|
||||
let a: @differentiable (Float) -> Float // okay
|
||||
// CHECK: (pattern_named 'a'
|
||||
// CHECK-NEXT: (type_attributed attrs=@differentiable(reverse)
|
||||
// CHECK: (pattern_named "a"
|
||||
// CHECK-NEXT: (type_attributed attrs="@differentiable(reverse) "
|
||||
|
||||
let b: @differentiable(reverse) (Float) -> Float // okay
|
||||
// CHECK: (pattern_named 'b'
|
||||
// CHECK-NEXT: (type_attributed attrs=@differentiable(reverse)
|
||||
// CHECK: (pattern_named "b"
|
||||
// CHECK-NEXT: (type_attributed attrs="@differentiable(reverse) "
|
||||
|
||||
let c: @differentiable(reverse) (Float, @noDerivative Float) -> Float // okay
|
||||
// CHECK: (pattern_named 'c'
|
||||
// CHECK-NEXT: (type_attributed attrs=@differentiable(reverse)
|
||||
// CHECK: (pattern_named "c"
|
||||
// CHECK-NEXT: (type_attributed attrs="@differentiable(reverse) "
|
||||
// CHECK-NEXT: (type_function
|
||||
// CHECK-NEXT: (type_tuple
|
||||
// CHECK-NEXT: (type_ident id='Float' bind=none)
|
||||
// CHECK-NEXT: (type_attributed attrs=@noDerivative
|
||||
// CHECK-NEXT: (type_ident id='Float' bind=none))
|
||||
// CHECK-NEXT: (type_ident id='Float' bind=none))))
|
||||
// CHECK-NEXT: (type_ident id="Float" unbound)
|
||||
// CHECK-NEXT: (type_attributed attrs="@noDerivative "
|
||||
// CHECK-NEXT: (type_ident id="Float" unbound))
|
||||
// CHECK-NEXT: (type_ident id="Float" unbound))))
|
||||
|
||||
let d: @differentiable(reverse) (Float) throws -> Float // okay
|
||||
// CHECK: (pattern_named 'd'
|
||||
// CHECK-NEXT: (type_attributed attrs=@differentiable(reverse)
|
||||
// CHECK: (pattern_named "d"
|
||||
// CHECK-NEXT: (type_attributed attrs="@differentiable(reverse) "
|
||||
|
||||
let e: @differentiable(reverse) (Float) throws -> Float // okay
|
||||
// CHECK: (pattern_named 'e'
|
||||
// CHECK-NEXT: (type_attributed attrs=@differentiable(reverse)
|
||||
// CHECK: (pattern_named "e"
|
||||
// CHECK-NEXT: (type_attributed attrs="@differentiable(reverse) "
|
||||
|
||||
// Generic type test.
|
||||
struct A<T> {
|
||||
func foo() {
|
||||
let local: @differentiable(reverse) (T) -> T // okay
|
||||
// CHECK: (pattern_named 'local'
|
||||
// CHECK-NEXT: (type_attributed attrs=@differentiable(reverse)
|
||||
// CHECK: (pattern_named "local"
|
||||
// CHECK-NEXT: (type_attributed attrs="@differentiable(reverse) "
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,29 +49,29 @@ let d: @differentiable(notValidArg) (Float) -> Float
|
||||
struct B {
|
||||
struct linear {}
|
||||
let propertyB1: @differentiable(reverse) (linear) -> Float // okay
|
||||
// CHECK: (pattern_named 'propertyB1'
|
||||
// CHECK-NEXT: (type_attributed attrs=@differentiable(reverse)
|
||||
// CHECK: (pattern_named "propertyB1"
|
||||
// CHECK-NEXT: (type_attributed attrs="@differentiable(reverse) "
|
||||
|
||||
let propertyB2: @differentiable(reverse) (linear) -> linear // okay
|
||||
// CHECK: (pattern_named 'propertyB2'
|
||||
// CHECK-NEXT: (type_attributed attrs=@differentiable(reverse)
|
||||
// CHECK: (pattern_named "propertyB2"
|
||||
// CHECK-NEXT: (type_attributed attrs="@differentiable(reverse) "
|
||||
|
||||
let propertyB3: @differentiable(reverse) (linear, linear) -> linear // okay
|
||||
// CHECK: (pattern_named 'propertyB3'
|
||||
// CHECK-NEXT: (type_attributed attrs=@differentiable(reverse)
|
||||
// CHECK: (pattern_named "propertyB3"
|
||||
// CHECK-NEXT: (type_attributed attrs="@differentiable(reverse) "
|
||||
|
||||
let propertyB4: @differentiable(reverse) (linear, Float) -> linear // okay
|
||||
// CHECK: (pattern_named 'propertyB4'
|
||||
// CHECK-NEXT: (type_attributed attrs=@differentiable(reverse)
|
||||
// CHECK: (pattern_named "propertyB4"
|
||||
// CHECK-NEXT: (type_attributed attrs="@differentiable(reverse) "
|
||||
|
||||
let propertyB5: @differentiable(reverse) (Float, linear) -> linear // okay
|
||||
// CHECK: (pattern_named 'propertyB5'
|
||||
// CHECK-NEXT: (type_attributed attrs=@differentiable(reverse)
|
||||
// CHECK: (pattern_named "propertyB5"
|
||||
// CHECK-NEXT: (type_attributed attrs="@differentiable(reverse) "
|
||||
|
||||
let propertyB6: @differentiable(reverse) (linear, linear, Float, linear)
|
||||
-> Float // okay
|
||||
// CHECK: (pattern_named 'propertyB6'
|
||||
// CHECK-NEXT: (type_attributed attrs=@differentiable(reverse)
|
||||
// CHECK: (pattern_named "propertyB6"
|
||||
// CHECK-NEXT: (type_attributed attrs="@differentiable(reverse) "
|
||||
|
||||
// expected-error @+1 {{expected ')' in '@differentiable' attribute}}
|
||||
let propertyB7: @differentiable(reverse (linear) -> Float
|
||||
@@ -81,21 +81,21 @@ struct B {
|
||||
struct C {
|
||||
typealias reverse = (C) -> C
|
||||
let propertyC1: @differentiable(reverse) (reverse) -> Float // okay
|
||||
// CHECK: (pattern_named 'propertyC1'
|
||||
// CHECK-NEXT: (type_attributed attrs=@differentiable(reverse)
|
||||
// CHECK: (pattern_named "propertyC1"
|
||||
// CHECK-NEXT: (type_attributed attrs="@differentiable(reverse) "
|
||||
|
||||
let propertyC2: @differentiable(reverse) (reverse) -> reverse // okay
|
||||
// CHECK: (pattern_named 'propertyC2'
|
||||
// CHECK-NEXT: (type_attributed attrs=@differentiable(reverse)
|
||||
// CHECK: (pattern_named "propertyC2"
|
||||
// CHECK-NEXT: (type_attributed attrs="@differentiable(reverse) "
|
||||
|
||||
let propertyC3: @differentiable(reverse) reverse // okay
|
||||
// CHECK: (pattern_named 'propertyC3'
|
||||
// CHECK-NEXT: (type_attributed attrs=@differentiable(reverse)
|
||||
// CHECK: (pattern_named "propertyC3"
|
||||
// CHECK-NEXT: (type_attributed attrs="@differentiable(reverse) "
|
||||
|
||||
let propertyC4: reverse // okay
|
||||
// CHECK: (pattern_named 'propertyC4'
|
||||
// CHECK: (pattern_named "propertyC4"
|
||||
|
||||
let propertyC6: @differentiable(reverse) @convention(c) reverse // okay
|
||||
// CHECK: (pattern_named 'propertyC6'
|
||||
// CHECK-NEXT: (type_attributed attrs=@differentiable(reverse)
|
||||
// CHECK: (pattern_named "propertyC6"
|
||||
// CHECK-NEXT: (type_attributed attrs="@differentiable(reverse) @convention(c) "
|
||||
}
|
||||
|
||||
@@ -62,13 +62,13 @@ extension MainProtocol {
|
||||
@main struct MyMain : AsyncMainProtocol {}
|
||||
#endif
|
||||
|
||||
// CHECK-IS-SYNC-LABEL: "MyMain" interface type='MyMain.Type'
|
||||
// CHECK-IS-SYNC: (func_decl implicit "$main()" interface type='(MyMain.Type) -> () -> ()'
|
||||
// CHECK-IS-SYNC: (declref_expr implicit type='(MyMain.Type) -> () -> ()'
|
||||
// CHECK-IS-SYNC-LABEL: "MyMain" interface type="MyMain.Type"
|
||||
// CHECK-IS-SYNC: (func_decl implicit "$main()" interface type="(MyMain.Type) -> () -> ()"
|
||||
// CHECK-IS-SYNC: (declref_expr implicit type="(MyMain.Type) -> () -> ()"
|
||||
|
||||
// CHECK-IS-ASYNC-LABEL: "MyMain" interface type='MyMain.Type'
|
||||
// CHECK-IS-ASYNC: (func_decl implicit "$main()" interface type='(MyMain.Type) -> () async -> ()'
|
||||
// CHECK-IS-ASYNC: (declref_expr implicit type='(MyMain.Type) -> () async -> ()'
|
||||
// CHECK-IS-ASYNC-LABEL: "MyMain" interface type="MyMain.Type"
|
||||
// CHECK-IS-ASYNC: (func_decl implicit "$main()" interface type="(MyMain.Type) -> () async -> ()"
|
||||
// CHECK-IS-ASYNC: (declref_expr implicit type="(MyMain.Type) -> () async -> ()"
|
||||
|
||||
// CHECK-IS-ERROR1: error: 'MyMain' is annotated with @main and must provide a main static function of type {{\(\) -> Void or \(\) throws -> Void|\(\) -> Void, \(\) throws -> Void, \(\) async -> Void, or \(\) async throws -> Void}}
|
||||
// CHECK-IS-ERROR2: error: ambiguous use of 'main'
|
||||
|
||||
@@ -18,32 +18,32 @@ extension MyActor {
|
||||
func testClosureIsolation() async {
|
||||
// CHECK: acceptClosure
|
||||
// CHECK: closure_expr
|
||||
// CHECK: actor-isolated
|
||||
// CHECK: actor_isolated
|
||||
acceptClosure { self.syncMethod() }
|
||||
|
||||
// CHECK: acceptSendableClosure
|
||||
// CHECK: closure_expr
|
||||
// CHECK-NOT: actor-isolated
|
||||
// CHECK-NOT: actor_isolated
|
||||
acceptSendableClosure { print(self) }
|
||||
|
||||
// CHECK: acceptAsyncClosure
|
||||
// CHECK: closure_expr
|
||||
// CHECK-SAME: actor-isolated=closure_isolation.(file).MyActor extension.testClosureIsolation().self
|
||||
// CHECK-SAME: actor_isolated="closure_isolation.(file).MyActor extension.testClosureIsolation().self@
|
||||
acceptAsyncClosure { await method() }
|
||||
|
||||
// CHECK: acceptAsyncClosure
|
||||
// CHECK: closure_expr
|
||||
// CHECK-NOT: actor-isolated
|
||||
// CHECK-NOT: actor_isolated
|
||||
acceptAsyncClosure { () async in print() }
|
||||
|
||||
// CHECK: acceptEscapingAsyncClosure
|
||||
// CHECK: closure_expr
|
||||
// CHECK: actor-isolated
|
||||
// CHECK: actor_isolated
|
||||
acceptEscapingAsyncClosure { self.syncMethod() }
|
||||
|
||||
// CHECK: acceptEscapingAsyncClosure
|
||||
// CHECK: closure_expr
|
||||
// CHECK: actor-isolated
|
||||
// CHECK: actor_isolated
|
||||
acceptEscapingAsyncClosure { () async in print(self) }
|
||||
}
|
||||
}
|
||||
@@ -63,21 +63,21 @@ func someAsyncFunc() async { }
|
||||
@SomeGlobalActor func someGlobalActorFunc() async {
|
||||
// CHECK: acceptAsyncClosure
|
||||
// CHECK: closure_expr
|
||||
// CHECK-SAME: global-actor-isolated=SomeGlobalActor
|
||||
// CHECK-SAME: global_actor_isolated="SomeGlobalActor"
|
||||
acceptAsyncClosure { await someAsyncFunc() }
|
||||
|
||||
// CHECK: acceptAsyncClosure
|
||||
// CHECK: closure_expr
|
||||
// CHECK-SAME: global-actor-isolated=SomeGlobalActor
|
||||
// CHECK-SAME: global_actor_isolated="SomeGlobalActor"
|
||||
acceptAsyncClosure { () async in print("hello") }
|
||||
|
||||
// CHECK: acceptEscapingAsyncClosure
|
||||
// CHECK: closure_expr
|
||||
// CHECK: actor-isolated
|
||||
// CHECK: actor_isolated
|
||||
acceptEscapingAsyncClosure { await someAsyncFunc() }
|
||||
|
||||
// CHECK: acceptEscapingAsyncClosure
|
||||
// CHECK: closure_expr
|
||||
// CHECK: actor-isolated
|
||||
// CHECK: actor_isolated
|
||||
acceptEscapingAsyncClosure { () async in print("hello") }
|
||||
}
|
||||
|
||||
@@ -16,28 +16,28 @@ protocol App {
|
||||
|
||||
// Load in the source file name and grab line numbers for default main funcs
|
||||
// CHECK: (source_file "[[SOURCE_FILE:[^"]+]]"
|
||||
// CHECK: (extension_decl range={{\[}}[[SOURCE_FILE]]:{{[0-9]+}}:{{[0-9]+}} - line:{{[0-9]+}}:{{[0-9]+}}{{\]}} App where
|
||||
// CHECK: (extension_decl range={{\[}}[[SOURCE_FILE]]:{{[0-9]+}}:{{[0-9]+}} - line:{{[0-9]+}}:{{[0-9]+}}{{\]}} App where
|
||||
// CHECK: (extension_decl range={{\[}}[[SOURCE_FILE]]:{{[0-9]+}}:{{[0-9]+}} - line:{{[0-9]+}}:{{[0-9]+}}{{\]}} App where
|
||||
// CHECK: (extension_decl range={{\[}}[[SOURCE_FILE]]:{{[0-9]+}}:{{[0-9]+}} - line:{{[0-9]+}}:{{[0-9]+}}{{\]}} "App" where
|
||||
// CHECK: (extension_decl range={{\[}}[[SOURCE_FILE]]:{{[0-9]+}}:{{[0-9]+}} - line:{{[0-9]+}}:{{[0-9]+}}{{\]}} "App" where
|
||||
// CHECK: (extension_decl range={{\[}}[[SOURCE_FILE]]:{{[0-9]+}}:{{[0-9]+}} - line:{{[0-9]+}}:{{[0-9]+}}{{\]}} "App" where
|
||||
// CHECK: (extension_decl range={{\[}}[[SOURCE_FILE]]:{{[0-9]+}}:{{[0-9]+}} - line:{{[0-9]+}}:{{[0-9]+}}{{\]}}
|
||||
// CHECK-NOT: where
|
||||
// CHECK-NEXT: (func_decl range={{\[}}[[SOURCE_FILE]]:[[DEFAULT_ASYNCHRONOUS_MAIN_LINE:[0-9]+]]:{{[0-9]+}} - line:{{[0-9]+}}:{{[0-9]+}}{{\]}} "main()"
|
||||
// CHECK-SAME: interface type='<Self where Self : App> (Self.Type) -> () async -> ()'
|
||||
// CHECK-SAME: interface type="<Self where Self : App> (Self.Type) -> () async -> ()"
|
||||
|
||||
extension App where Configuration == Config1 {
|
||||
// CHECK-CONFIG1: (func_decl implicit "$main()" interface type='(MainType.Type) -> () -> ()'
|
||||
// CHECK-CONFIG1: (func_decl implicit "$main()" interface type="(MainType.Type) -> () -> ()"
|
||||
// CHECK-CONFIG1: [[SOURCE_FILE]]:[[# @LINE+1 ]]
|
||||
static func main() { }
|
||||
}
|
||||
|
||||
extension App where Configuration == Config2 {
|
||||
// CHECK-CONFIG2: (func_decl implicit "$main()" interface type='(MainType.Type) -> () async -> ()'
|
||||
// CHECK-CONFIG2: (func_decl implicit "$main()" interface type="(MainType.Type) -> () async -> ()"
|
||||
// CHECK-CONFIG2: [[SOURCE_FILE]]:[[# @LINE+1 ]]
|
||||
static func main() async { }
|
||||
}
|
||||
|
||||
extension App where Configuration == Config3 {
|
||||
// CHECK-CONFIG3-ASYNC: (func_decl implicit "$main()" interface type='(MainType.Type) -> () async -> ()'
|
||||
// CHECK-CONFIG3-ASYNC: (func_decl implicit "$main()" interface type="(MainType.Type) -> () async -> ()"
|
||||
// CHECK-CONFIG3-ASYNC: [[SOURCE_FILE]]:[[DEFAULT_ASYNCHRONOUS_MAIN_LINE]]
|
||||
}
|
||||
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
// `0 as <#Type#>` should get literal bound early via equality constraint.
|
||||
|
||||
// CHECK: ---Constraint solving at [{{.*}}:12:1 - line:12:13]---
|
||||
// CHECK: (integer_literal_expr type='[[LITERAL_VAR:\$T[0-9]+]]' {{.*}}
|
||||
// CHECK: (integer_literal_expr type="[[LITERAL_VAR:\$T[0-9]+]]" {{.*}}
|
||||
// CHECK: Type Variables:
|
||||
// CHECK: [[LITERAL_VAR]] as UInt32 {{.*}}
|
||||
// CHECK-NOT: disjunction (remembered) \[\[locator@{{.*}} [Coerce@{{.*}}\]\]]:
|
||||
_ = UInt32(0)
|
||||
|
||||
// CHECK: ---Constraint solving at [{{.*}}22:1 - line:22:13]---
|
||||
// CHECK: (coerce_expr implicit type='[[CAST_TYPE:\$T[0-9]+]]' {{.*}}
|
||||
// CHECK-NEXT: (nil_literal_expr type='[[LITERAL_VAR:\$T[0-9]+]]' {{.*}}
|
||||
// CHECK: (coerce_expr implicit type="[[CAST_TYPE:\$T[0-9]+]]" {{.*}}
|
||||
// CHECK-NEXT: (nil_literal_expr type="[[LITERAL_VAR:\$T[0-9]+]]" {{.*}}
|
||||
// CHECK: Type Variables:
|
||||
// CHECK: [[LITERAL_VAR]] as Int? {{.*}}
|
||||
// CHECK: disjunction (remembered) {{.*}}
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
// CHECK: declref_expr type='module<SomeModule>'
|
||||
// CHECK-NEXT: type_expr type='Data.Type'
|
||||
// CHECK: declref_expr type="module<SomeModule>"
|
||||
// CHECK-NEXT: type_expr type="Data.Type"
|
||||
let type = SomeModule.Data.self
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
// https://github.com/apple/swift/issues/58019
|
||||
|
||||
func fetch() {
|
||||
// CHECK: open_existential_expr implicit type='Void'
|
||||
// CHECK: opaque_value_expr implicit type='any MyError'
|
||||
// CHECK-NOT: type='SryMap<$T{{.*}}>.Failure'
|
||||
// CHECK: open_existential_expr implicit type="Void"
|
||||
// CHECK: opaque_value_expr implicit type="any MyError"
|
||||
// CHECK-NOT: type="SryMap<$T{{.*}}>.Failure"
|
||||
sryMap { return "" }
|
||||
.napError{ $0.abc() }
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ enum NonBarBaz {
|
||||
|
||||
let _: Foo<Bar> = Foo<Bar> { (a: Bar) -> Void in
|
||||
switch a {
|
||||
// CHECK: (pattern_is type='any Bar' value_cast Baz
|
||||
// CHECK-NEXT: (pattern_enum_element type='Baz' Baz.someCase
|
||||
// CHECK: (pattern_is type="any Bar" cast_kind=value_cast cast_to="Baz"
|
||||
// CHECK-NEXT: (pattern_enum_element type="Baz" element="Baz.someCase"
|
||||
case let .someCase(value) as Baz:
|
||||
print(value)
|
||||
// expected-warning@-1 {{cast from 'any Bar' to unrelated type 'NonBarBaz' always fails}}
|
||||
|
||||
@@ -6,9 +6,9 @@ struct B {
|
||||
|
||||
struct A {
|
||||
init(_ other: B) {}
|
||||
// CHECK: constructor_decl{{.*}}interface type='(A.Type) -> (B?) -> A'
|
||||
// CHECK: constructor_decl{{.*}}interface type="(A.Type) -> (B?) -> A"
|
||||
init(_ other: B?) {
|
||||
// CHECK: dot_syntax_call_expr type='(B) -> A'
|
||||
// CHECK: dot_syntax_call_expr type="(B) -> A"
|
||||
self.init(other ?? ._none)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ do {
|
||||
func test<T, U>(_: T, @Builder _: () -> some P<U>) {}
|
||||
|
||||
// CHECK: ---Initial constraints for the given expression---
|
||||
// CHECK: (integer_literal_expr type='[[LITERAL_VAR:\$T[0-9]+]]' {{.*}}
|
||||
// CHECK: (integer_literal_expr type="[[LITERAL_VAR:\$T[0-9]+]]" {{.*}}
|
||||
// CHECK: (attempting type variable binding [[CLOSURE:\$T[0-9]+]] := () -> {{.*}}
|
||||
// CHECK-NOT: (attempting type variable binding [[LITERAL_VAR]] := {{.*}}
|
||||
// CHECK: (attempting conjunction element pattern binding element @ 0
|
||||
@@ -48,7 +48,7 @@ do {
|
||||
func test<T, U>(_: T, @Builder _: (T) -> some P<U>) {}
|
||||
|
||||
// CHECK: ---Initial constraints for the given expression---
|
||||
// CHECK: (integer_literal_expr type='[[LITERAL_VAR:\$T[0-9]+]]' {{.*}}
|
||||
// CHECK: (integer_literal_expr type="[[LITERAL_VAR:\$T[0-9]+]]" {{.*}}
|
||||
// CHECK: (attempting type variable binding [[LITERAL_VAR]] := Int
|
||||
// CHECK: (attempting conjunction element pattern binding element @ 0
|
||||
test(42) { v in
|
||||
@@ -63,12 +63,12 @@ do {
|
||||
// CHECK: ---Initial constraints for the given expression---
|
||||
// CHECK: (attempting type variable {{.*}} := () -> {{.*}}
|
||||
// CHECK: (attempting conjunction element pattern binding element @ 0 :
|
||||
// CHECK-NEXT: (pattern_named 'x')
|
||||
// CHECK-NEXT: (pattern_named "x")
|
||||
// CHECK: (attempting conjunction element syntactic element
|
||||
// CHECK-NEXT: (call_expr {{.*}}
|
||||
// CHECK: (attempting type variable {{.*}} := (Bool) -> {{.*}}
|
||||
// CHECK: (attempting conjunction element pattern binding element @ 0
|
||||
// CHECK: (pattern_named implicit '$__builder{{.*}}')
|
||||
// CHECK: (pattern_named implicit "$__builder{{.*}}")
|
||||
// CHECK: (applying conjunction result to outer context
|
||||
// CHECK: (attempting type variable {{.*}} := (Int?) -> {{.*}}
|
||||
// CHECK: (attempting disjunction choice {{.*}} bound to decl {{.*}}.Int.init(_:)
|
||||
|
||||
@@ -22,34 +22,34 @@ struct ProtocolSubstitution: P {
|
||||
typealias A = Int
|
||||
|
||||
// CHECK: var_decl{{.*}}x1
|
||||
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature=<T> (substitution T -> Int))
|
||||
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature='<T>' 'T -> Int')
|
||||
var x1: [S] { S() }
|
||||
|
||||
// CHECK: var_decl{{.*}}x2
|
||||
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature=<T> (substitution T -> ProtocolSubstitution))
|
||||
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature='<T>' 'T -> ProtocolSubstitution')
|
||||
var x2: [S] { S() }
|
||||
}
|
||||
|
||||
// CHECK: struct_decl{{.*}}ArchetypeSubstitution
|
||||
struct ArchetypeSubstitution<A>: P {
|
||||
// CHECK: var_decl{{.*}}x1
|
||||
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature=<T> (substitution T -> A))
|
||||
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature='<T>' 'T -> A')
|
||||
var x1: [S] { S() }
|
||||
|
||||
// CHECK: var_decl{{.*}}x2
|
||||
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature=<T> (substitution T -> ArchetypeSubstitution<A>))
|
||||
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature='<T>' 'T -> ArchetypeSubstitution<A>')
|
||||
var x2: [S] { S() }
|
||||
}
|
||||
|
||||
// CHECK-LABEL: struct_decl{{.*}}ExplicitGenericAttribute
|
||||
struct ExplicitGenericAttribute<T: P> {
|
||||
// CHECK: var_decl{{.*}}x1
|
||||
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature=<T> (substitution T -> T))
|
||||
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature='<T>' 'T -> T')
|
||||
@Builder<T>
|
||||
var x1: [S] { S() }
|
||||
|
||||
// CHECK: var_decl{{.*}}x2
|
||||
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature=<T> (substitution T -> T.A))
|
||||
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature='<T>' 'T -> T.A')
|
||||
@Builder<T.A>
|
||||
var x2: [S] { S() }
|
||||
}
|
||||
@@ -61,10 +61,10 @@ extension ConcreteTypeSubstitution: P where Value == Int {
|
||||
typealias A = Value
|
||||
|
||||
// CHECK: var_decl{{.*}}x1
|
||||
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature=<T> (substitution T -> Int))
|
||||
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature='<T>' 'T -> Int')
|
||||
var x1: [S] { S() }
|
||||
|
||||
// CHECK: var_decl{{.*}}x2
|
||||
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature=<T> (substitution T -> ConcreteTypeSubstitution<Int>))
|
||||
// CHECK: Builder.buildBlock{{.*}}(substitution_map generic_signature='<T>' 'T -> ConcreteTypeSubstitution<Int>')
|
||||
var x2: [S] { S() }
|
||||
}
|
||||
|
||||
@@ -49,8 +49,8 @@ func tuplify<T>(@TupleBuilder body: (E) throws -> T) rethrows {
|
||||
tuplify {
|
||||
switch $0 {
|
||||
// CHECK: (case_body_variables
|
||||
// CHECK-NEXT: (var_decl implicit {{.*}} "a" interface type='String' let readImpl=stored immutable)
|
||||
// CHECK-NEXT: (var_decl implicit {{.*}} "b" interface type='Int' let readImpl=stored immutable)
|
||||
// CHECK-NEXT: (var_decl implicit {{.*}} "a" interface type="String" let readImpl=stored immutable)
|
||||
// CHECK-NEXT: (var_decl implicit {{.*}} "b" interface type="Int" let readImpl=stored immutable)
|
||||
case let .test(a, b):
|
||||
a
|
||||
b
|
||||
@@ -58,8 +58,8 @@ tuplify {
|
||||
|
||||
switch $0 {
|
||||
// CHECK: (case_body_variables
|
||||
// CHECK-NEXT: (var_decl implicit {{.*}} "a" interface type='String' let readImpl=stored immutable)
|
||||
// CHECK-NEXT: (var_decl implicit {{.*}} "b" interface type='Int' let readImpl=stored immutable)
|
||||
// CHECK-NEXT: (var_decl implicit {{.*}} "a" interface type="String" let readImpl=stored immutable)
|
||||
// CHECK-NEXT: (var_decl implicit {{.*}} "b" interface type="Int" let readImpl=stored immutable)
|
||||
case .test(let a, let b):
|
||||
a
|
||||
b
|
||||
@@ -67,21 +67,21 @@ tuplify {
|
||||
|
||||
switch $0 {
|
||||
// CHECK: (case_body_variables
|
||||
// CHECK-NEXT: (var_decl implicit {{.*}} "value" interface type='(a: String, b: Int)' let readImpl=stored immutable)
|
||||
// CHECK-NEXT: (var_decl implicit {{.*}} "value" interface type="(a: String, b: Int)" let readImpl=stored immutable)
|
||||
case let .test((value)):
|
||||
value.a
|
||||
}
|
||||
|
||||
switch $0 {
|
||||
// CHECK: (case_body_variables
|
||||
// CHECK-NEXT: (var_decl implicit {{.*}} "value" interface type='(a: String, b: Int)' let readImpl=stored immutable)
|
||||
// CHECK-NEXT: (var_decl implicit {{.*}} "value" interface type="(a: String, b: Int)" let readImpl=stored immutable)
|
||||
case let .test(value):
|
||||
value.a
|
||||
}
|
||||
|
||||
switch $0 {
|
||||
// CHECK: (case_body_variables
|
||||
// CHECK-NEXT: (var_decl implicit {{.*}} "value" interface type='(a: String, b: Int)' let readImpl=stored immutable)
|
||||
// CHECK-NEXT: (var_decl implicit {{.*}} "value" interface type="(a: String, b: Int)" let readImpl=stored immutable)
|
||||
case .test(let value):
|
||||
value.a
|
||||
}
|
||||
|
||||
@@ -23,10 +23,10 @@ import ObjCModule
|
||||
|
||||
let pureSwift = Int32(42)
|
||||
// FAIL-NOT: var_decl
|
||||
// CHECK: var_decl "pureSwift" {{.*}} type='Int32'
|
||||
// SWIFTONLY: var_decl "pureSwift" {{.*}} type='Int32'
|
||||
// CHECK: var_decl "pureSwift" {{.*}} type="Int32"
|
||||
// SWIFTONLY: var_decl "pureSwift" {{.*}} type="Int32"
|
||||
|
||||
let point = Point(x: 1, y: 2)
|
||||
// CHECK: var_decl "point" {{.*}} type='Point'
|
||||
// CHECK: var_decl "point" {{.*}} type="Point"
|
||||
// SWIFTONLY-NOT: var_decl "point"
|
||||
|
||||
|
||||
@@ -25,21 +25,21 @@ distributed actor DefaultWorker {
|
||||
}
|
||||
|
||||
// Check DefaultWorker, the DefaultActor version of the synthesis:
|
||||
// CHECK: (class_decl range=[{{.*}}] "DefaultWorker" interface type='DefaultWorker.Type' access=internal non-resilient actor
|
||||
// CHECK: (class_decl range=[{{.*}}] "DefaultWorker" interface type="DefaultWorker.Type" access=internal non_resilient distributed actor
|
||||
// The unowned executor property:
|
||||
// CHECK: (var_decl implicit "unownedExecutor" interface type='UnownedSerialExecutor' access=internal final readImpl=getter immutable
|
||||
// CHECK: (var_decl implicit "unownedExecutor" interface type="UnownedSerialExecutor" access=internal final readImpl=getter immutable
|
||||
|
||||
// We guard the rest of the body; we only return a default executor if the actor is local:
|
||||
// CHECK: (guard_stmt implicit
|
||||
// CHECK: (call_expr implicit type='Bool' nothrow
|
||||
// CHECK: (declref_expr implicit type='@_NO_EXTINFO (AnyObject) -> Bool' decl=Distributed.(file).__isLocalActor function_ref=unapplied)
|
||||
// CHECK: (call_expr implicit type="Bool" nothrow
|
||||
// CHECK: (declref_expr implicit type="@_NO_EXTINFO (AnyObject) -> Bool" decl="Distributed.(file).__isLocalActor" function_ref=unapplied)
|
||||
|
||||
// Check that we create the "remote reference" executor:
|
||||
// CHECK: (return_stmt implicit
|
||||
// CHECK: (call_expr implicit type='UnownedSerialExecutor' nothrow
|
||||
// CHECK: (declref_expr implicit type='(DefaultWorker) -> UnownedSerialExecutor' decl=Distributed.(file).buildDefaultDistributedRemoteActorExecutor [with (substitution_map generic_signature=<Act where Act : DistributedActor> (substitution Act -> DefaultWorker))]
|
||||
// CHECK: (call_expr implicit type="UnownedSerialExecutor" nothrow
|
||||
// CHECK: (declref_expr implicit type="(DefaultWorker) -> UnownedSerialExecutor" decl="Distributed.(file).buildDefaultDistributedRemoteActorExecutor [with (substitution_map generic_signature='<Act where Act : DistributedActor>' 'Act -> DefaultWorker')]"
|
||||
|
||||
// Check the default executor synthesis for local actor otherwise:
|
||||
// CHECK: (return_stmt implicit
|
||||
// CHECK: (call_expr implicit type='Builtin.Executor' nothrow
|
||||
// CHECK: (declref_expr implicit type='(DefaultWorker) -> Builtin.Executor' decl=Builtin.(file).buildDefaultActorExecutorRef [with (substitution_map generic_signature=<T where T : AnyObject> (substitution T -> DefaultWorker))] function_ref=unapplied)
|
||||
// CHECK: (call_expr implicit type="Builtin.Executor" nothrow
|
||||
// CHECK: (declref_expr implicit type="(DefaultWorker) -> Builtin.Executor" decl="Builtin.(file).buildDefaultActorExecutorRef [with (substitution_map generic_signature='<T where T : AnyObject>' 'T -> DefaultWorker')]" function_ref=unapplied)
|
||||
|
||||
@@ -32,9 +32,9 @@ protocol P3 {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: StructDecl name=Basic
|
||||
// CHECK: (normal_conformance type=Basic protocol=P1
|
||||
// CHECK-NEXT: (assoc_type req=A type=Int)
|
||||
// CHECK-NEXT: (value req=f() witness=main.(file).Basic.f()@{{.*}}))
|
||||
// CHECK: (normal_conformance type="Basic" protocol="P1"
|
||||
// CHECK-NEXT: (assoc_type req="A" type="Int")
|
||||
// CHECK-NEXT: (value req="f()" witness="main.(file).Basic.f()@{{.*}}"))
|
||||
struct Basic: P1 {
|
||||
typealias A = Int
|
||||
func f() -> Int { fatalError() }
|
||||
@@ -43,11 +43,11 @@ struct Basic: P1 {
|
||||
// Recursive conformances should have finite output.
|
||||
|
||||
// CHECK-LABEL: StructDecl name=Recur
|
||||
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2
|
||||
// CHECK-NEXT: (assoc_type req=A type=Recur)
|
||||
// CHECK-NEXT: (assoc_type req=B type=Recur)
|
||||
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2 (details printed above))
|
||||
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2 (details printed above)))
|
||||
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2"
|
||||
// CHECK-NEXT: (assoc_type req="A" type="Recur")
|
||||
// CHECK-NEXT: (assoc_type req="B" type="Recur")
|
||||
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>)
|
||||
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>))
|
||||
struct Recur: P2 {
|
||||
typealias A = Recur
|
||||
typealias B = Recur
|
||||
@@ -56,15 +56,15 @@ struct Recur: P2 {
|
||||
// The full information about a conformance doesn't need to be printed twice.
|
||||
|
||||
// CHECK-LABEL: StructDecl name=NonRecur
|
||||
// CHECK-NEXT: (normal_conformance type=NonRecur protocol=P2
|
||||
// CHECK-NEXT: (assoc_type req=A type=Recur)
|
||||
// CHECK-NEXT: (assoc_type req=B type=Recur)
|
||||
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2
|
||||
// CHECK-NEXT: (assoc_type req=A type=Recur)
|
||||
// CHECK-NEXT: (assoc_type req=B type=Recur)
|
||||
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2 (details printed above))
|
||||
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2 (details printed above)))
|
||||
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2 (details printed above)))
|
||||
// CHECK-NEXT: (normal_conformance type="NonRecur" protocol="P2"
|
||||
// CHECK-NEXT: (assoc_type req="A" type="Recur")
|
||||
// CHECK-NEXT: (assoc_type req="B" type="Recur")
|
||||
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2"
|
||||
// CHECK-NEXT: (assoc_type req="A" type="Recur")
|
||||
// CHECK-NEXT: (assoc_type req="B" type="Recur")
|
||||
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>)
|
||||
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>))
|
||||
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>))
|
||||
struct NonRecur: P2 {
|
||||
typealias A = Recur
|
||||
typealias B = Recur
|
||||
@@ -77,10 +77,10 @@ struct NonRecur: P2 {
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=Generic
|
||||
struct Generic<T> {}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=Generic
|
||||
// CHECK-NEXT: (normal_conformance type=Generic<T> protocol=P1
|
||||
// CHECK-NEXT: (assoc_type req=A type=T)
|
||||
// CHECK-NEXT: (value req=f() witness=main.(file).Generic extension.f()@{{.*}})
|
||||
// CHECK-NEXT: conforms_to: T P1)
|
||||
// CHECK-NEXT: (normal_conformance type="Generic<T>" protocol="P1"
|
||||
// CHECK-NEXT: (assoc_type req="A" type="T")
|
||||
// CHECK-NEXT: (value req="f()" witness="main.(file).Generic extension.f()@{{.*}}")
|
||||
// CHECK-NEXT: (requirement "T" conforms_to "P1")
|
||||
extension Generic: P1 where T: P1 {
|
||||
typealias A = T
|
||||
func f() -> T { fatalError() }
|
||||
@@ -94,13 +94,13 @@ extension Generic: P1 where T: P1 {
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=Super
|
||||
class Super<T, U> {}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=Super
|
||||
// CHECK-NEXT: (normal_conformance type=Super<T, U> protocol=P2
|
||||
// CHECK-NEXT: (assoc_type req=A type=T)
|
||||
// CHECK-NEXT: (assoc_type req=B type=T)
|
||||
// CHECK-NEXT: (abstract_conformance protocol=P2)
|
||||
// CHECK-NEXT: (abstract_conformance protocol=P2)
|
||||
// CHECK-NEXT: conforms_to: T P2
|
||||
// CHECK-NEXT: conforms_to: U P2)
|
||||
// CHECK-NEXT: (normal_conformance type="Super<T, U>" protocol="P2"
|
||||
// CHECK-NEXT: (assoc_type req="A" type="T")
|
||||
// CHECK-NEXT: (assoc_type req="B" type="T")
|
||||
// CHECK-NEXT: (abstract_conformance protocol="P2")
|
||||
// CHECK-NEXT: (abstract_conformance protocol="P2")
|
||||
// CHECK-NEXT: (requirement "T" conforms_to "P2")
|
||||
// CHECK-NEXT: (requirement "U" conforms_to "P2"))
|
||||
extension Super: P2 where T: P2, U: P2 {
|
||||
typealias A = T
|
||||
typealias B = T
|
||||
@@ -108,55 +108,55 @@ extension Super: P2 where T: P2, U: P2 {
|
||||
|
||||
// Inherited/specialized conformances.
|
||||
// CHECK-LABEL: ClassDecl name=Sub
|
||||
// CHECK-NEXT: (inherited_conformance type=Sub protocol=P2
|
||||
// CHECK-NEXT: (specialized_conformance type=Super<NonRecur, Recur> protocol=P2
|
||||
// CHECK-NEXT: (substitution_map generic_signature=<T, U where T : P2, U : P2>
|
||||
// CHECK-NEXT: (substitution T -> NonRecur)
|
||||
// CHECK-NEXT: (substitution U -> Recur)
|
||||
// CHECK-NEXT: (conformance type=T
|
||||
// CHECK-NEXT: (normal_conformance type=NonRecur protocol=P2
|
||||
// CHECK-NEXT: (assoc_type req=A type=Recur)
|
||||
// CHECK-NEXT: (assoc_type req=B type=Recur)
|
||||
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2
|
||||
// CHECK-NEXT: (assoc_type req=A type=Recur)
|
||||
// CHECK-NEXT: (assoc_type req=B type=Recur)
|
||||
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2 (details printed above))
|
||||
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2 (details printed above)))
|
||||
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2 (details printed above))))
|
||||
// CHECK-NEXT: (conformance type=U
|
||||
// CHECK-NEXT: (normal_conformance type=Recur protocol=P2 (details printed above))))
|
||||
// CHECK-NEXT: (conditional requirements unable to be computed)
|
||||
// CHECK-NEXT: (normal_conformance type=Super<T, U> protocol=P2
|
||||
// CHECK-NEXT: (assoc_type req=A type=T)
|
||||
// CHECK-NEXT: (assoc_type req=B type=T)
|
||||
// CHECK-NEXT: (abstract_conformance protocol=P2)
|
||||
// CHECK-NEXT: (abstract_conformance protocol=P2)
|
||||
// CHECK-NEXT: conforms_to: T P2
|
||||
// CHECK-NEXT: conforms_to: U P2)))
|
||||
// CHECK-NEXT: (inherited_conformance type="Sub" protocol="P2"
|
||||
// CHECK-NEXT: (specialized_conformance type="Super<NonRecur, Recur>" protocol="P2"
|
||||
// CHECK-NEXT: (substitution_map generic_signature="<T, U where T : P2, U : P2>"
|
||||
// CHECK-NEXT: (substitution "T -> NonRecur")
|
||||
// CHECK-NEXT: (substitution "U -> Recur")
|
||||
// CHECK-NEXT: (conformance type="T"
|
||||
// CHECK-NEXT: (normal_conformance type="NonRecur" protocol="P2"
|
||||
// CHECK-NEXT: (assoc_type req="A" type="Recur")
|
||||
// CHECK-NEXT: (assoc_type req="B" type="Recur")
|
||||
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2"
|
||||
// CHECK-NEXT: (assoc_type req="A" type="Recur")
|
||||
// CHECK-NEXT: (assoc_type req="B" type="Recur")
|
||||
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>)
|
||||
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>))
|
||||
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>)))
|
||||
// CHECK-NEXT: (conformance type="U"
|
||||
// CHECK-NEXT: (normal_conformance type="Recur" protocol="P2" <details printed above>)))
|
||||
// CHECK-NEXT: (<conditional requirements unable to be computed>)
|
||||
// CHECK-NEXT: (normal_conformance type="Super<T, U>" protocol="P2"
|
||||
// CHECK-NEXT: (assoc_type req="A" type="T")
|
||||
// CHECK-NEXT: (assoc_type req="B" type="T")
|
||||
// CHECK-NEXT: (abstract_conformance protocol="P2")
|
||||
// CHECK-NEXT: (abstract_conformance protocol="P2")
|
||||
// CHECK-NEXT: (requirement "T" conforms_to "P2")
|
||||
// CHECK-NEXT: (requirement "U" conforms_to "P2"))))
|
||||
class Sub: Super<NonRecur, Recur> {}
|
||||
|
||||
// Specialization of a recursive conformance should be okay: recursion detection
|
||||
// should work through SubstitutionMaps.
|
||||
|
||||
// CHECK-LABEL: StructDecl name=RecurGeneric
|
||||
// CHECK-NEXT: (normal_conformance type=RecurGeneric<T> protocol=P3
|
||||
// CHECK-NEXT: (assoc_type req=A type=RecurGeneric<T>)
|
||||
// CHECK-NEXT: (normal_conformance type=RecurGeneric<T> protocol=P3 (details printed above)))
|
||||
// CHECK-NEXT: (normal_conformance type="RecurGeneric<T>" protocol="P3"
|
||||
// CHECK-NEXT: (assoc_type req="A" type="RecurGeneric<T>")
|
||||
// CHECK-NEXT: (normal_conformance type="RecurGeneric<T>" protocol="P3" <details printed above>))
|
||||
struct RecurGeneric<T: P3>: P3 {
|
||||
typealias A = RecurGeneric<T>
|
||||
}
|
||||
|
||||
// CHECK-LABEL: StructDecl name=Specialize
|
||||
// CHECK-NEXT: (normal_conformance type=Specialize protocol=P3
|
||||
// CHECK-NEXT: (assoc_type req=A type=RecurGeneric<Specialize>)
|
||||
// CHECK-NEXT: (specialized_conformance type=Specialize.A protocol=P3
|
||||
// CHECK-NEXT: (substitution_map generic_signature=<T where T : P3>
|
||||
// CHECK-NEXT: (substitution T -> Specialize)
|
||||
// CHECK-NEXT: (conformance type=T
|
||||
// CHECK-NEXT: (normal_conformance type=Specialize protocol=P3 (details printed above))))
|
||||
// CHECK-NEXT: (normal_conformance type=RecurGeneric<T> protocol=P3
|
||||
// CHECK-NEXT: (assoc_type req=A type=RecurGeneric<T>)
|
||||
// CHECK-NEXT: (normal_conformance type=RecurGeneric<T> protocol=P3 (details printed above)))))
|
||||
// CHECK-NEXT: (normal_conformance type="Specialize" protocol="P3"
|
||||
// CHECK-NEXT: (assoc_type req="A" type="RecurGeneric<Specialize>")
|
||||
// CHECK-NEXT: (specialized_conformance type="Specialize.A" protocol="P3"
|
||||
// CHECK-NEXT: (substitution_map generic_signature="<T where T : P3>"
|
||||
// CHECK-NEXT: (substitution "T -> Specialize")
|
||||
// CHECK-NEXT: (conformance type="T"
|
||||
// CHECK-NEXT: (normal_conformance type="Specialize" protocol="P3" <details printed above>)))
|
||||
// CHECK-NEXT: (normal_conformance type="RecurGeneric<T>" protocol="P3"
|
||||
// CHECK-NEXT: (assoc_type req="A" type="RecurGeneric<T>")
|
||||
// CHECK-NEXT: (normal_conformance type="RecurGeneric<T>" protocol="P3" <details printed above>))))
|
||||
struct Specialize: P3 {
|
||||
typealias A = RecurGeneric<Specialize>
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
func foo(_ n: Int) -> Int {
|
||||
// CHECK: (brace_stmt
|
||||
// CHECK: (return_stmt
|
||||
// CHECK: (integer_literal_expr type='<null>' value=42 {{.*}})))
|
||||
// CHECK: (integer_literal_expr type="<null>" value="42" {{.*}})))
|
||||
// CHECK-AST: (brace_stmt
|
||||
// CHECK-AST: (return_stmt
|
||||
// CHECK-AST: (integer_literal_expr type='{{[^']+}}' {{.*}} value=42 {{.*}})
|
||||
// CHECK-AST: (integer_literal_expr type="{{[^"]+}}" {{.*}} value="42" {{.*}})
|
||||
return 42
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@ func foo(_ n: Int) -> Int {
|
||||
// CHECK-AST-LABEL: (func_decl{{.*}}"bar()"
|
||||
func bar() {
|
||||
// CHECK: (brace_stmt
|
||||
// CHECK-NEXT: (unresolved_decl_ref_expr type='{{[^']+}}' name=foo
|
||||
// CHECK-NEXT: (unresolved_decl_ref_expr type='{{[^']+}}' name=foo
|
||||
// CHECK-NEXT: (unresolved_decl_ref_expr type='{{[^']+}}' name=foo
|
||||
// CHECK-NEXT: (unresolved_decl_ref_expr type="{{[^"]+}}" name="foo"
|
||||
// CHECK-NEXT: (unresolved_decl_ref_expr type="{{[^"]+}}" name="foo"
|
||||
// CHECK-NEXT: (unresolved_decl_ref_expr type="{{[^"]+}}" name="foo"
|
||||
// CHECK-AST: (brace_stmt
|
||||
// CHECK-AST-NEXT: (declref_expr type='{{[^']+}}' {{.*}} decl=main.(file).foo
|
||||
// CHECK-AST-NEXT: (declref_expr type='{{[^']+}}' {{.*}} decl=main.(file).foo
|
||||
// CHECK-AST-NEXT: (declref_expr type='{{[^']+}}' {{.*}} decl=main.(file).foo
|
||||
// CHECK-AST-NEXT: (declref_expr type="{{[^"]+}}" {{.*}} decl="main.(file).foo@
|
||||
// CHECK-AST-NEXT: (declref_expr type="{{[^"]+}}" {{.*}} decl="main.(file).foo@
|
||||
// CHECK-AST-NEXT: (declref_expr type="{{[^"]+}}" {{.*}} decl="main.(file).foo@
|
||||
foo foo foo
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ enum TrailingSemi {
|
||||
case A,B;
|
||||
|
||||
// CHECK-LABEL: (subscript_decl{{.*}}trailing_semi
|
||||
// CHECK-NOT: (func_decl{{.*}}trailing_semi 'anonname={{.*}}' get_for=subscript(_:)
|
||||
// CHECK: (accessor_decl{{.*}}'anonname={{.*}}' get_for=subscript(_:)
|
||||
// CHECK-NOT: (func_decl{{.*}}trailing_semi <anonymous @ 0x{{[0-9a-f]+}}> get for="subscript(_:)"
|
||||
// CHECK: (accessor_decl{{.*}} <anonymous @ 0x{{[0-9a-f]+}}> get for="subscript(_:)"
|
||||
subscript(x: Int) -> Int {
|
||||
// CHECK-LABEL: (pattern_binding_decl{{.*}}trailing_semi
|
||||
// CHECK-NOT: (var_decl{{.*}}trailing_semi "y"
|
||||
@@ -55,26 +55,26 @@ enum TrailingSemi {
|
||||
};
|
||||
|
||||
// The substitution map for a declref should be relatively unobtrusive.
|
||||
// CHECK-AST-LABEL: (func_decl{{.*}}"generic(_:)" <T : Hashable> interface type='<T where T : Hashable> (T) -> ()' access=internal captures=(<generic> )
|
||||
// CHECK-AST-LABEL: (func_decl{{.*}}"generic(_:)" "<T : Hashable>" interface type="<T where T : Hashable> (T) -> ()" access=internal captures=(<generic> )
|
||||
func generic<T: Hashable>(_: T) {}
|
||||
// CHECK-AST: (pattern_binding_decl
|
||||
// CHECK-AST: (declref_expr type='(Int) -> ()' location={{.*}} range={{.*}} decl=main.(file).generic@{{.*}} [with (substitution_map generic_signature=<T where T : Hashable> (substitution T -> Int))] function_ref=unapplied))
|
||||
// CHECK-AST: (processed_init=declref_expr type="(Int) -> ()" location={{.*}} range={{.*}} decl="main.(file).generic@{{.*}} [with (substitution_map generic_signature='<T where T : Hashable>' 'T -> Int')]" function_ref=unapplied))
|
||||
let _: (Int) -> () = generic
|
||||
|
||||
// Closures should be marked as escaping or not.
|
||||
func escaping(_: @escaping (Int) -> Int) {}
|
||||
escaping({ $0 })
|
||||
// CHECK-AST: (declref_expr type='(@escaping (Int) -> Int) -> ()'
|
||||
// CHECK-AST: (declref_expr type="(@escaping (Int) -> Int) -> ()"
|
||||
// CHECK-AST-NEXT: (argument_list
|
||||
// CHECK-AST-NEXT: (argument
|
||||
// CHECK-AST-NEXT: (closure_expr type='(Int) -> Int' {{.*}} discriminator=0 escaping single-expression
|
||||
// CHECK-AST-NEXT: (closure_expr type="(Int) -> Int" {{.*}} discriminator=0 escaping single_expression
|
||||
|
||||
func nonescaping(_: (Int) -> Int) {}
|
||||
nonescaping({ $0 })
|
||||
// CHECK-AST: (declref_expr type='((Int) -> Int) -> ()'
|
||||
// CHECK-AST: (declref_expr type="((Int) -> Int) -> ()"
|
||||
// CHECK-AST-NEXT: (argument_list
|
||||
// CHECK-AST-NEXT: (argument
|
||||
// CHECK-AST-NEXT: (closure_expr type='(Int) -> Int' {{.*}} discriminator=1 single-expression
|
||||
// CHECK-AST-NEXT: (closure_expr type="(Int) -> Int" {{.*}} discriminator=1 single_expression
|
||||
|
||||
// CHECK-LABEL: (struct_decl range=[{{.+}}] "MyStruct")
|
||||
struct MyStruct {}
|
||||
@@ -85,23 +85,23 @@ enum MyEnum {
|
||||
// CHECK-LABEL: (enum_case_decl range=[{{.+}}]
|
||||
// CHECK-NEXT: (enum_element_decl range=[{{.+}}] "foo(x:)"
|
||||
// CHECK-NEXT: (parameter_list range=[{{.+}}]
|
||||
// CHECK-NEXT: (parameter "x" apiName=x)))
|
||||
// CHECK-NEXT: (parameter "x" apiName="x")))
|
||||
// CHECK-NEXT: (enum_element_decl range=[{{.+}}] "bar"))
|
||||
// CHECK-NEXT: (enum_element_decl range=[{{.+}}] "foo(x:)"
|
||||
// CHECK-NEXT: (parameter_list range=[{{.+}}]
|
||||
// CHECK-NEXT: (parameter "x" apiName=x)))
|
||||
// CHECK-NEXT: (parameter "x" apiName="x")))
|
||||
// CHECK-NEXT: (enum_element_decl range=[{{.+}}] "bar"))
|
||||
case foo(x: MyStruct), bar
|
||||
}
|
||||
|
||||
// CHECK-LABEL: (top_level_code_decl range=[{{.+}}]
|
||||
// CHECK-NEXT: (brace_stmt implicit range=[{{.+}}]
|
||||
// CHECK-NEXT: (sequence_expr type='<null>'
|
||||
// CHECK-NEXT: (discard_assignment_expr type='<null>')
|
||||
// CHECK-NEXT: (assign_expr type='<null>'
|
||||
// CHECK-NEXT: (**NULL EXPRESSION**)
|
||||
// CHECK-NEXT: (**NULL EXPRESSION**))
|
||||
// CHECK-NEXT: (closure_expr type='<null>' discriminator={{[0-9]+}}
|
||||
// CHECK-NEXT: (sequence_expr type="<null>"
|
||||
// CHECK-NEXT: (discard_assignment_expr type="<null>")
|
||||
// CHECK-NEXT: (assign_expr type="<null>"
|
||||
// CHECK-NEXT: (<null expr>)
|
||||
// CHECK-NEXT: (<null expr>))
|
||||
// CHECK-NEXT: (closure_expr type="<null>" discriminator={{[0-9]+}}
|
||||
// CHECK-NEXT: (parameter_list range=[{{.+}}]
|
||||
// CHECK-NEXT: (parameter "v"))
|
||||
// CHECK-NEXT: (brace_stmt range=[{{.+}}])))))
|
||||
@@ -113,13 +113,12 @@ struct SelfParam {
|
||||
// CHECK-LABEL: (func_decl range=[{{.+}}] "createOptional()" type
|
||||
// CHECK-NEXT: (parameter "self")
|
||||
// CHECK-NEXT: (parameter_list range=[{{.+}}])
|
||||
// CHECK-NEXT: (result
|
||||
// CHECK-NEXT: (type_optional
|
||||
// CHECK-NEXT: (type_ident id='SelfParam' bind=none)))
|
||||
// CHECK-NEXT: (result=type_optional
|
||||
// CHECK-NEXT: (type_ident id="SelfParam" unbound))
|
||||
static func createOptional() -> SelfParam? {
|
||||
|
||||
// CHECK-LABEL: (call_expr type='<null>'
|
||||
// CHECK-NEXT: (unresolved_decl_ref_expr type='<null>' name=SelfParam function_ref=unapplied)
|
||||
// CHECK-LABEL: (call_expr type="<null>"
|
||||
// CHECK-NEXT: (unresolved_decl_ref_expr type="<null>" name="SelfParam" function_ref=unapplied)
|
||||
// CHECK-NEXT: (argument_list)
|
||||
SelfParam()
|
||||
}
|
||||
@@ -127,9 +126,8 @@ struct SelfParam {
|
||||
|
||||
// CHECK-LABEL: (func_decl range=[{{.+}}] "dumpMemberTypeRepr()"
|
||||
// CHECK-NEXT: (parameter_list range=[{{.+}}])
|
||||
// CHECK-NEXT: (result
|
||||
// CHECK-NEXT: (type_member
|
||||
// CHECK-NEXT: (type_ident id='Array' bind=none)
|
||||
// CHECK-NEXT: (type_ident id='Bool' bind=none)
|
||||
// CHECK-NEXT: (type_ident id='Element' bind=none)))
|
||||
// CHECK-NEXT: (result=type_member
|
||||
// CHECK-NEXT: (type_ident id="Array" unbound
|
||||
// CHECK-NEXT: (type_ident id="Bool" unbound))
|
||||
// CHECK-NEXT: (type_ident id="Element" unbound))
|
||||
func dumpMemberTypeRepr() -> Array<Bool>.Element { true }
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
// RUN: %target-swift-frontend -dump-ast %t/FileLib.swift -module-alias XLogging=AppleLogging -I %t > %t/result-ast.output
|
||||
|
||||
// RUN: %FileCheck %s -input-file %t/result-ast.output -check-prefix CHECK-AST
|
||||
// CHECK-AST-NOT: bind=XLogging
|
||||
// CHECK-AST-NOT: bind="XLogging"
|
||||
// CHECK-AST-NOT: module<XLogging>
|
||||
// CHECK-AST-NOT: decl=XLogging
|
||||
// CHECK-AST: type_ident id='XLogging' bind=AppleLogging
|
||||
// CHECK-AST-NOT: decl="XLogging"
|
||||
// CHECK-AST: type_ident id="XLogging" bind="AppleLogging"
|
||||
// CHECK-AST: module<AppleLogging>
|
||||
// CHECK-AST: decl=AppleLogging
|
||||
// CHECK-AST: decl="AppleLogging"
|
||||
|
||||
// BEGIN FileLogging.swift
|
||||
public struct Logger {
|
||||
|
||||
@@ -19,8 +19,8 @@ func takes_P5<X: P5>(_: X) {}
|
||||
|
||||
struct Free<T> {}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=Free
|
||||
// CHECK-NEXT: (normal_conformance type=Free<T> protocol=P2
|
||||
// CHECK-NEXT: conforms_to: T P1)
|
||||
// CHECK-NEXT: (normal_conformance type="Free<T>" protocol="P2"
|
||||
// CHECK-NEXT: (requirement "T" conforms_to "P1"))
|
||||
extension Free: P2 where T: P1 {}
|
||||
// expected-note@-1 {{requirement from conditional conformance of 'Free<U>' to 'P2'}}
|
||||
// expected-note@-2 {{requirement from conditional conformance of 'Free<T>' to 'P2'}}
|
||||
@@ -34,8 +34,8 @@ func free_bad<U>(_: U) {
|
||||
struct Constrained<T: P1> {}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=Constrained
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=Constrained
|
||||
// CHECK-NEXT: (normal_conformance type=Constrained<T> protocol=P2
|
||||
// CHECK-NEXT: conforms_to: T P3)
|
||||
// CHECK-NEXT: (normal_conformance type="Constrained<T>" protocol="P2"
|
||||
// CHECK-NEXT: (requirement "T" conforms_to "P3"))
|
||||
extension Constrained: P2 where T: P3 {} // expected-note {{requirement from conditional conformance of 'Constrained<U>' to 'P2'}}
|
||||
func constrained_good<U: P1 & P3>(_: U) {
|
||||
takes_P2(Constrained<U>())
|
||||
@@ -47,22 +47,22 @@ func constrained_bad<U: P1>(_: U) {
|
||||
struct RedundantSame<T: P1> {}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=RedundantSame
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=RedundantSame
|
||||
// CHECK-NEXT: (normal_conformance type=RedundantSame<T> protocol=P2)
|
||||
// CHECK-NEXT: (normal_conformance type="RedundantSame<T>" protocol="P2")
|
||||
extension RedundantSame: P2 where T: P1 {}
|
||||
// expected-warning@-1 {{redundant conformance constraint 'T' : 'P1'}}
|
||||
|
||||
struct RedundantSuper<T: P4> {}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=RedundantSuper
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=RedundantSuper
|
||||
// CHECK-NEXT: (normal_conformance type=RedundantSuper<T> protocol=P2)
|
||||
// CHECK-NEXT: (normal_conformance type="RedundantSuper<T>" protocol="P2")
|
||||
extension RedundantSuper: P2 where T: P1 {}
|
||||
// expected-warning@-1 {{redundant conformance constraint 'T' : 'P1'}}
|
||||
|
||||
struct OverlappingSub<T: P1> {}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=OverlappingSub
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=OverlappingSub
|
||||
// CHECK-NEXT: (normal_conformance type=OverlappingSub<T> protocol=P2
|
||||
// CHECK-NEXT: conforms_to: T P4)
|
||||
// CHECK-NEXT: (normal_conformance type="OverlappingSub<T>" protocol="P2"
|
||||
// CHECK-NEXT: (requirement "T" conforms_to "P4"))
|
||||
extension OverlappingSub: P2 where T: P4 {} // expected-note {{requirement from conditional conformance of 'OverlappingSub<U>' to 'P2'}}
|
||||
// expected-warning@-1 {{redundant conformance constraint 'T' : 'P1'}}
|
||||
func overlapping_sub_good<U: P4>(_: U) {
|
||||
@@ -76,8 +76,8 @@ func overlapping_sub_bad<U: P1>(_: U) {
|
||||
struct SameType<T> {}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=SameType
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=SameType
|
||||
// CHECK-NEXT: (normal_conformance type=SameType<T> protocol=P2
|
||||
// CHECK-NEXT: same_type: T Int)
|
||||
// CHECK-NEXT: (normal_conformance type="SameType<T>" protocol="P2"
|
||||
// CHECK-NEXT: (requirement "T" same_type "Int"))
|
||||
extension SameType: P2 where T == Int {}
|
||||
// expected-note@-1 {{requirement from conditional conformance of 'SameType<U>' to 'P2'}}
|
||||
// expected-note@-2 {{requirement from conditional conformance of 'SameType<Float>' to 'P2'}}
|
||||
@@ -93,8 +93,8 @@ func same_type_bad<U>(_: U) {
|
||||
struct SameTypeGeneric<T, U> {}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=SameTypeGeneric
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=SameTypeGeneric
|
||||
// CHECK-NEXT: (normal_conformance type=SameTypeGeneric<T, U> protocol=P2
|
||||
// CHECK-NEXT: same_type: T U)
|
||||
// CHECK-NEXT: (normal_conformance type="SameTypeGeneric<T, U>" protocol="P2"
|
||||
// CHECK-NEXT: (requirement "T" same_type "U"))
|
||||
extension SameTypeGeneric: P2 where T == U {}
|
||||
// expected-note@-1 {{requirement from conditional conformance of 'SameTypeGeneric<U, Int>' to 'P2'}}
|
||||
// expected-note@-2 {{requirement from conditional conformance of 'SameTypeGeneric<Int, Float>' to 'P2'}}
|
||||
@@ -119,9 +119,9 @@ func same_type_bad<U, V>(_: U, _: V) {
|
||||
struct Infer<T, U> {}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=Infer
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=Infer
|
||||
// CHECK-NEXT: (normal_conformance type=Infer<T, U> protocol=P2
|
||||
// CHECK-NEXT: same_type: T Constrained<U>
|
||||
// CHECK-NEXT: conforms_to: U P1)
|
||||
// CHECK-NEXT: (normal_conformance type="Infer<T, U>" protocol="P2"
|
||||
// CHECK-NEXT: (requirement "T" same_type "Constrained<U>")
|
||||
// CHECK-NEXT: (requirement "U" conforms_to "P1"))
|
||||
extension Infer: P2 where T == Constrained<U> {}
|
||||
// expected-note@-1 2 {{requirement from conditional conformance of 'Infer<Constrained<U>, V>' to 'P2'}}
|
||||
func infer_good<U: P1>(_: U) {
|
||||
@@ -138,8 +138,8 @@ func infer_bad<U: P1, V>(_: U, _: V) {
|
||||
struct InferRedundant<T, U: P1> {}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=InferRedundant
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=InferRedundant
|
||||
// CHECK-NEXT: (normal_conformance type=InferRedundant<T, U> protocol=P2
|
||||
// CHECK-NEXT: same_type: T Constrained<U>)
|
||||
// CHECK-NEXT: (normal_conformance type="InferRedundant<T, U>" protocol="P2"
|
||||
// CHECK-NEXT: (requirement "T" same_type "Constrained<U>"))
|
||||
extension InferRedundant: P2 where T == Constrained<U> {}
|
||||
func infer_redundant_good<U: P1>(_: U) {
|
||||
takes_P2(InferRedundant<Constrained<U>, U>())
|
||||
@@ -159,8 +159,8 @@ class C3: C2 {}
|
||||
struct ClassFree<T> {}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=ClassFree
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=ClassFree
|
||||
// CHECK-NEXT: (normal_conformance type=ClassFree<T> protocol=P2
|
||||
// CHECK-NEXT: superclass: T C1)
|
||||
// CHECK-NEXT: (normal_conformance type="ClassFree<T>" protocol="P2"
|
||||
// CHECK-NEXT: (requirement "T" subclass_of "C1"))
|
||||
extension ClassFree: P2 where T: C1 {} // expected-note {{requirement from conditional conformance of 'ClassFree<U>' to 'P2'}}
|
||||
func class_free_good<U: C1>(_: U) {
|
||||
takes_P2(ClassFree<U>())
|
||||
@@ -173,8 +173,8 @@ func class_free_bad<U>(_: U) {
|
||||
struct ClassMoreSpecific<T: C1> {}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=ClassMoreSpecific
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=ClassMoreSpecific
|
||||
// CHECK-NEXT: (normal_conformance type=ClassMoreSpecific<T> protocol=P2
|
||||
// CHECK-NEXT: superclass: T C3)
|
||||
// CHECK-NEXT: (normal_conformance type="ClassMoreSpecific<T>" protocol="P2"
|
||||
// CHECK-NEXT: (requirement "T" subclass_of "C3"))
|
||||
extension ClassMoreSpecific: P2 where T: C3 {} // expected-note {{requirement from conditional conformance of 'ClassMoreSpecific<U>' to 'P2'}}
|
||||
// expected-warning@-1 {{redundant superclass constraint 'T' : 'C1'}}
|
||||
func class_more_specific_good<U: C3>(_: U) {
|
||||
@@ -189,7 +189,7 @@ func class_more_specific_bad<U: C1>(_: U) {
|
||||
struct ClassLessSpecific<T: C3> {}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=ClassLessSpecific
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=ClassLessSpecific
|
||||
// CHECK-NEXT: (normal_conformance type=ClassLessSpecific<T> protocol=P2)
|
||||
// CHECK-NEXT: (normal_conformance type="ClassLessSpecific<T>" protocol="P2")
|
||||
extension ClassLessSpecific: P2 where T: C1 {}
|
||||
// expected-warning@-1 {{redundant superclass constraint 'T' : 'C1'}}
|
||||
|
||||
@@ -213,15 +213,15 @@ func subclass_bad() {
|
||||
struct InheritEqual<T> {}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=InheritEqual
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=InheritEqual
|
||||
// CHECK-NEXT: (normal_conformance type=InheritEqual<T> protocol=P2
|
||||
// CHECK-NEXT: conforms_to: T P1)
|
||||
// CHECK-NEXT: (normal_conformance type="InheritEqual<T>" protocol="P2"
|
||||
// CHECK-NEXT: (requirement "T" conforms_to "P1"))
|
||||
extension InheritEqual: P2 where T: P1 {} // expected-note {{requirement from conditional conformance of 'InheritEqual<U>' to 'P2'}}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=InheritEqual
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=InheritEqual
|
||||
// CHECK-NEXT: (normal_conformance type=InheritEqual<T> protocol=P5
|
||||
// CHECK-NEXT: (normal_conformance type=InheritEqual<T> protocol=P2
|
||||
// CHECK-NEXT: conforms_to: T P1)
|
||||
// CHECK-NEXT: conforms_to: T P1)
|
||||
// CHECK-NEXT: (normal_conformance type="InheritEqual<T>" protocol="P5"
|
||||
// CHECK-NEXT: (normal_conformance type="InheritEqual<T>" protocol="P2"
|
||||
// CHECK-NEXT: (requirement "T" conforms_to "P1"))
|
||||
// CHECK-NEXT: (requirement "T" conforms_to "P1"))
|
||||
extension InheritEqual: P5 where T: P1 {} // expected-note {{requirement from conditional conformance of 'InheritEqual<U>' to 'P5'}}
|
||||
func inheritequal_good<U: P1>(_: U) {
|
||||
takes_P2(InheritEqual<U>())
|
||||
@@ -245,15 +245,15 @@ extension InheritLess: P5 {}
|
||||
struct InheritMore<T> {}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=InheritMore
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=InheritMore
|
||||
// CHECK-NEXT: (normal_conformance type=InheritMore<T> protocol=P2
|
||||
// CHECK-NEXT: conforms_to: T P1)
|
||||
// CHECK-NEXT: (normal_conformance type="InheritMore<T>" protocol="P2"
|
||||
// CHECK-NEXT: (requirement "T" conforms_to "P1"))
|
||||
extension InheritMore: P2 where T: P1 {} // expected-note {{requirement from conditional conformance of 'InheritMore<U>' to 'P2'}}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=InheritMore
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=InheritMore
|
||||
// CHECK-NEXT: (normal_conformance type=InheritMore<T> protocol=P5
|
||||
// CHECK-NEXT: (normal_conformance type=InheritMore<T> protocol=P2
|
||||
// CHECK-NEXT: conforms_to: T P1)
|
||||
// CHECK-NEXT: conforms_to: T P4)
|
||||
// CHECK-NEXT: (normal_conformance type="InheritMore<T>" protocol="P5"
|
||||
// CHECK-NEXT: (normal_conformance type="InheritMore<T>" protocol="P2"
|
||||
// CHECK-NEXT: (requirement "T" conforms_to "P1"))
|
||||
// CHECK-NEXT: (requirement "T" conforms_to "P4"))
|
||||
extension InheritMore: P5 where T: P4 {} // expected-note 2 {{requirement from conditional conformance of 'InheritMore<U>' to 'P5'}}
|
||||
func inheritequal_good_good<U: P4>(_: U) {
|
||||
takes_P2(InheritMore<U>())
|
||||
@@ -334,17 +334,17 @@ extension TwoDisjointConformances: P2 where T == String {}
|
||||
struct RedundancyOrderDependenceGood<T: P1, U> {}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=RedundancyOrderDependenceGood
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=RedundancyOrderDependenceGood
|
||||
// CHECK-NEXT: (normal_conformance type=RedundancyOrderDependenceGood<T, U> protocol=P2
|
||||
// CHECK-NEXT: same_type: T U)
|
||||
// CHECK-NEXT: (normal_conformance type="RedundancyOrderDependenceGood<T, U>" protocol="P2"
|
||||
// CHECK-NEXT: (requirement "T" same_type "U"))
|
||||
extension RedundancyOrderDependenceGood: P2 where U: P1, T == U {}
|
||||
// expected-warning@-1 {{redundant conformance constraint 'U' : 'P1'}}
|
||||
|
||||
struct RedundancyOrderDependenceBad<T, U: P1> {}
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=RedundancyOrderDependenceBad
|
||||
// CHECK-LABEL: ExtensionDecl line={{.*}} base=RedundancyOrderDependenceBad
|
||||
// CHECK-NEXT: (normal_conformance type=RedundancyOrderDependenceBad<T, U> protocol=P2
|
||||
// CHECK-NEXT: conforms_to: T P1
|
||||
// CHECK-NEXT: same_type: T U)
|
||||
// CHECK-NEXT: (normal_conformance type="RedundancyOrderDependenceBad<T, U>" protocol="P2"
|
||||
// CHECK-NEXT: (requirement "T" conforms_to "P1")
|
||||
// CHECK-NEXT: (requirement "T" same_type "U"))
|
||||
extension RedundancyOrderDependenceBad: P2 where T: P1, T == U {} // expected-warning {{redundant conformance constraint 'U' : 'P1'}}
|
||||
|
||||
// Checking of conditional requirements for existential conversions.
|
||||
|
||||
@@ -14,9 +14,9 @@ struct G<X> {}
|
||||
// CHECK-NEXT: Generic signature: <X where X == Derived>
|
||||
extension G where X : Base, X : P, X == Derived {}
|
||||
|
||||
// RULE: + superclass: τ_0_0 Base
|
||||
// RULE: + conforms_to: τ_0_0 P
|
||||
// RULE: + same_type: τ_0_0 Derived
|
||||
// RULE: + (requirement "\xCF\x84_0_0" subclass_of "Base")
|
||||
// RULE: + (requirement "\xCF\x84_0_0" conforms_to "P")
|
||||
// RULE: + (requirement "\xCF\x84_0_0" same_type "Derived")
|
||||
|
||||
// RULE: Rewrite system: {
|
||||
// RULE-NEXT: - [P].[P] => [P] [permanent]
|
||||
@@ -36,4 +36,4 @@ extension G where X : Base, X : P, X == Derived {}
|
||||
//
|
||||
// - without concrete contraction, we used to hit a problem where the sort
|
||||
// in the minimal conformances algorithm would hit the unordered concrete
|
||||
// conformances [concrete: Derived : P] vs [concrete: Base : P].
|
||||
// conformances [concrete: Derived : P] vs [concrete: Base : P].
|
||||
|
||||
@@ -60,7 +60,7 @@ extension HasFooSub {
|
||||
func testHasFooSub(_ hfs: HasFooSub) -> Int {
|
||||
// CHECK: return_stmt
|
||||
// CHECK-NOT: func_decl
|
||||
// CHECK: member_ref_expr{{.*}}decl=overload_vars.(file).HasFoo.foo
|
||||
// CHECK: member_ref_expr{{.*}}decl="overload_vars.(file).HasFoo.foo
|
||||
return hfs.foo
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ extension HasBar {
|
||||
func testHasBar(_ hb: HasBar) -> Int {
|
||||
// CHECK: return_stmt
|
||||
// CHECK-NOT: func_decl
|
||||
// CHECK: member_ref_expr{{.*}}decl=overload_vars.(file).HasBar.bar
|
||||
// CHECK: member_ref_expr{{.*}}decl="overload_vars.(file).HasBar.bar
|
||||
return hb.bar
|
||||
}
|
||||
|
||||
|
||||
@@ -71,14 +71,13 @@ _ = ##"""
|
||||
// ===---------- False Multiline Delimiters --------===
|
||||
|
||||
/// Source code contains zero-width character in this format: `#"[U+200B]"[U+200B]"#`
|
||||
/// The check contains zero-width character in this format: `"[U+200B]\"[U+200B]"`
|
||||
/// If this check fails after you implement `diagnoseZeroWidthMatchAndAdvance`,
|
||||
/// then you may need to tweak how to test for single-line string literals that
|
||||
/// resemble a multiline delimiter in `advanceIfMultilineDelimiter` so that it
|
||||
/// passes again.
|
||||
/// See https://github.com/apple/swift/issues/51192.
|
||||
_ = #"""#
|
||||
// CHECK: "\""
|
||||
// CHECK: "\xE2\x80\x8B\"\xE2\x80\x8B"
|
||||
|
||||
_ = #""""#
|
||||
// CHECK: "\"\""
|
||||
|
||||
@@ -7,5 +7,5 @@ func string_interpolation() {
|
||||
|
||||
// RUN: not %target-swift-frontend -dump-ast %/s | %FileCheck %s
|
||||
// CHECK: (interpolated_string_literal_expr {{.*}} trailing_quote_loc=SOURCE_DIR/test/Parse/source_locs.swift:4:12 {{.*}}
|
||||
// CHECK: (editor_placeholder_expr type='()' {{.*}} trailing_angle_bracket_loc=SOURCE_DIR/test/Parse/source_locs.swift:5:9
|
||||
// CHECK: (editor_placeholder_expr type="()" {{.*}} trailing_angle_bracket_loc=SOURCE_DIR/test/Parse/source_locs.swift:5:9
|
||||
|
||||
|
||||
@@ -147,9 +147,9 @@ sil_vtable MyNumber {}
|
||||
// substituting we need to pick up the normal_conformance.
|
||||
|
||||
// CHECK-LABEL: sil @test_inlining : $@convention(objc_method) (@owned MyNumber) -> () {
|
||||
// CHECK-NOT: Generic specialization information for call-site dootherstuff <MyNumber & SomeProto> conformances <(abstract_conformance protocol=OtherProto)>
|
||||
// CHECK-NOT: Generic specialization information for call-site dootherstuff <MyNumber & SomeProto> conformances <(abstract_conformance protocol="OtherProto")>
|
||||
// CHECK: Generic specialization information
|
||||
// CHECK: (normal_conformance type=MyObject protocol=OtherProto)
|
||||
// CHECK: (normal_conformance type="MyObject" protocol="OtherProto")
|
||||
// CHECK: end sil function 'test_inlining'
|
||||
|
||||
sil @test_inlining : $@convention(objc_method) (@owned MyNumber) -> () {
|
||||
|
||||
@@ -670,8 +670,8 @@ sil @callee2 : $@convention(thin) <τ_0_0 where τ_0_0 : SubscriptionViewControl
|
||||
// CHECK: [[T5:%.*]] = function_ref @callee2 : $@convention(thin) <τ_0_0 where τ_0_0 : SubscriptionViewControllerDelegate> (@in τ_0_0, @thick SubscriptionViewControllerBuilder.Type) -> @owned SubscriptionViewControllerBuilder
|
||||
// CHECK: [[T6:%.*]] = alloc_stack $@opened("E4D92D2A-8893-11EA-9C89-ACDE48001122", any ResourceKitProtocol) Self
|
||||
// CHECK: copy_addr [[T4]] to [init] [[T6]] : $*@opened("E4D92D2A-8893-11EA-9C89-ACDE48001122", any ResourceKitProtocol) Self
|
||||
// CHECK: Generic specialization information for call-site callee2 <any ResourceKitProtocol> conformances <(inherited_conformance type=any ResourceKitProtocol protocol=SubscriptionViewControllerDelegate
|
||||
// CHECK: (normal_conformance type=MyObject protocol=SubscriptionViewControllerDelegate))>:
|
||||
// CHECK: Generic specialization information for call-site callee2 <any ResourceKitProtocol> conformances <(inherited_conformance type="any ResourceKitProtocol" protocol="SubscriptionViewControllerDelegate"
|
||||
// CHECK: (normal_conformance type="MyObject" protocol="SubscriptionViewControllerDelegate"))>:
|
||||
// CHECK: apply [[T5]]<@opened("E4D92D2A-8893-11EA-9C89-ACDE48001122", any ResourceKitProtocol) Self>([[T6]], [[T1]])
|
||||
|
||||
sil @test_opend_archetype_concrete_conformance_substitution : $@convention(method) (@guaranteed ResourceKitProtocol, @guaranteed ViewController) -> () {
|
||||
|
||||
@@ -19,32 +19,32 @@ class A {
|
||||
|
||||
class B: A {
|
||||
func test() -> Self {
|
||||
// CHECK: covariant_return_conversion_expr implicit type='Self' location={{.*}}.swift:[[@LINE+1]]
|
||||
// CHECK: covariant_return_conversion_expr implicit type="Self" location={{.*}}.swift:[[@LINE+1]]
|
||||
_ = super.method()
|
||||
// CHECK: covariant_function_conversion_expr implicit type='() -> Self' location={{.*}}.swift:[[@LINE+1]]
|
||||
// CHECK: covariant_function_conversion_expr implicit type="() -> Self" location={{.*}}.swift:[[@LINE+1]]
|
||||
_ = super.method
|
||||
// CHECK: covariant_return_conversion_expr implicit type='Self' location={{.*}}.swift:[[@LINE+1]]
|
||||
// CHECK: covariant_return_conversion_expr implicit type="Self" location={{.*}}.swift:[[@LINE+1]]
|
||||
_ = super.property
|
||||
// CHECK: covariant_return_conversion_expr implicit type='Self' location={{.*}}.swift:[[@LINE+1]]
|
||||
// CHECK: covariant_return_conversion_expr implicit type="Self" location={{.*}}.swift:[[@LINE+1]]
|
||||
_ = super[]
|
||||
|
||||
return super.property
|
||||
}
|
||||
|
||||
static func testStatic() -> Self {
|
||||
// CHECK: covariant_return_conversion_expr implicit type='Self' location={{.*}}.swift:[[@LINE+1]]
|
||||
// CHECK: covariant_return_conversion_expr implicit type="Self" location={{.*}}.swift:[[@LINE+1]]
|
||||
_ = super.staticMethod()
|
||||
// CHECK: covariant_function_conversion_expr implicit type='() -> Self' location={{.*}}.swift:[[@LINE+1]]
|
||||
// CHECK: covariant_function_conversion_expr implicit type="() -> Self" location={{.*}}.swift:[[@LINE+1]]
|
||||
_ = super.staticMethod
|
||||
// CHECK-NOT: function_conversion_expr {{.*}} location={{.*}}.swift:[[@LINE+3]]
|
||||
// CHECK-NOT: covariant_function_conversion_expr {{.*}} location={{.*}}.swift:[[@LINE+2]]
|
||||
// CHECK: covariant_return_conversion_expr implicit type='Self' location={{.*}}.swift:[[@LINE+1]]
|
||||
// CHECK: covariant_return_conversion_expr implicit type="Self" location={{.*}}.swift:[[@LINE+1]]
|
||||
_ = self.method
|
||||
// CHECK: covariant_return_conversion_expr implicit type='Self' location={{.*}}.swift:[[@LINE+1]]
|
||||
// CHECK: covariant_return_conversion_expr implicit type="Self" location={{.*}}.swift:[[@LINE+1]]
|
||||
_ = self.init()
|
||||
// CHECK: covariant_return_conversion_expr implicit type='Self' location={{.*}}.swift:[[@LINE+1]]
|
||||
// CHECK: covariant_return_conversion_expr implicit type="Self" location={{.*}}.swift:[[@LINE+1]]
|
||||
_ = super.staticProperty
|
||||
// CHECK: covariant_return_conversion_expr implicit type='Self' location={{.*}}.swift:[[@LINE+1]]
|
||||
// CHECK: covariant_return_conversion_expr implicit type="Self" location={{.*}}.swift:[[@LINE+1]]
|
||||
_ = super[]
|
||||
|
||||
return super.staticProperty
|
||||
@@ -53,8 +53,8 @@ class B: A {
|
||||
|
||||
func testOnExistential(arg: P & A) {
|
||||
// FIXME: This could be a single conversion.
|
||||
// CHECK: function_conversion_expr implicit type='() -> any A & P' location={{.*}}.swift:[[@LINE+2]]
|
||||
// CHECK-NEXT: covariant_function_conversion_expr implicit type='() -> any A & P' location={{.*}}.swift:[[@LINE+1]]
|
||||
// CHECK: function_conversion_expr implicit type="() -> any A & P" location={{.*}}.swift:[[@LINE+2]]
|
||||
// CHECK-NEXT: covariant_function_conversion_expr implicit type="() -> any A & P" location={{.*}}.swift:[[@LINE+1]]
|
||||
_ = arg.method
|
||||
}
|
||||
|
||||
|
||||
@@ -17,11 +17,11 @@ struct WrapperWithClosureArg<Value> {
|
||||
// rdar://problem/59685601
|
||||
// CHECK-LABEL: R_59685601
|
||||
struct R_59685601 {
|
||||
// CHECK: argument_list implicit labels=wrappedValue:reset:
|
||||
// CHECK-NEXT: argument label=wrappedValue
|
||||
// CHECK-NEXT: property_wrapper_value_placeholder_expr implicit type='String'
|
||||
// CHECK-NEXT: opaque_value_expr implicit type='String'
|
||||
// CHECK-NEXT: string_literal_expr type='String'
|
||||
// CHECK: argument_list implicit labels="wrappedValue:reset:"
|
||||
// CHECK-NEXT: argument label="wrappedValue"
|
||||
// CHECK-NEXT: property_wrapper_value_placeholder_expr implicit type="String"
|
||||
// CHECK-NEXT: opaque_value_expr implicit type="String"
|
||||
// CHECK-NEXT: string_literal_expr type="String"
|
||||
@WrapperWithClosureArg(reset: { value, transaction in
|
||||
transaction.state = 10
|
||||
})
|
||||
@@ -37,13 +37,13 @@ struct Wrapper<Value> {
|
||||
struct TestInitSubscript {
|
||||
enum Color: CaseIterable { case pink }
|
||||
|
||||
// CHECK: argument_list labels=wrappedValue:
|
||||
// CHECK-NEXT: argument label=wrappedValue
|
||||
// CHECK-NEXT: subscript_expr type='TestInitSubscript.Color'
|
||||
// CHECK: argument_list labels="wrappedValue:"
|
||||
// CHECK-NEXT: argument label="wrappedValue"
|
||||
// CHECK-NEXT: subscript_expr type="TestInitSubscript.Color"
|
||||
// CHECK: argument_list implicit
|
||||
// CHECK-NEXT: argument
|
||||
// CHECK-NOT: property_wrapper_value_placeholder_expr implicit type='Int'
|
||||
// CHECK: integer_literal_expr type='Int'
|
||||
// CHECK-NOT: property_wrapper_value_placeholder_expr implicit type="Int"
|
||||
// CHECK: integer_literal_expr type="Int"
|
||||
@Wrapper(wrappedValue: Color.allCases[0])
|
||||
var color: Color
|
||||
}
|
||||
@@ -68,19 +68,19 @@ public class W_58201<Value> {
|
||||
|
||||
// CHECK-LABEL: struct_decl{{.*}}S1_58201
|
||||
struct S1_58201 {
|
||||
// CHECK: argument_list implicit labels=wrappedValue:
|
||||
// CHECK-NEXT: argument label=wrappedValue
|
||||
// CHECK-NEXT: autoclosure_expr implicit type='() -> Bool?' discriminator=0 captures=(<opaque_value> ) escaping
|
||||
// CHECK: autoclosure_expr implicit type='() -> Bool?' discriminator=1 escaping
|
||||
// CHECK: argument_list implicit labels="wrappedValue:"
|
||||
// CHECK-NEXT: argument label="wrappedValue"
|
||||
// CHECK-NEXT: autoclosure_expr implicit type="() -> Bool?" discriminator=0 captures=(<opaque_value> ) escaping
|
||||
// CHECK: autoclosure_expr implicit type="() -> Bool?" discriminator=1 escaping
|
||||
@W_58201 var a: Bool?
|
||||
}
|
||||
|
||||
// CHECK-LABEL: struct_decl{{.*}}S2_58201
|
||||
struct S2_58201 {
|
||||
// CHECK: argument_list implicit labels=wrappedValue:
|
||||
// CHECK-NEXT: argument label=wrappedValue
|
||||
// CHECK-NEXT: autoclosure_expr implicit type='() -> Bool' location={{.*}}.swift:[[@LINE+2]]:26 range=[{{.+}}] discriminator=0 captures=(<opaque_value> ) escaping
|
||||
// CHECK: autoclosure_expr implicit type='() -> Bool' location={{.*}}.swift:[[@LINE+1]]:26 range=[{{.+}}] discriminator=1 escaping
|
||||
// CHECK: argument_list implicit labels="wrappedValue:"
|
||||
// CHECK-NEXT: argument label="wrappedValue"
|
||||
// CHECK-NEXT: autoclosure_expr implicit type="() -> Bool" location={{.*}}.swift:[[@LINE+2]]:26 range=[{{.+}}] discriminator=0 captures=(<opaque_value> ) escaping
|
||||
// CHECK: autoclosure_expr implicit type="() -> Bool" location={{.*}}.swift:[[@LINE+1]]:26 range=[{{.+}}] discriminator=1 escaping
|
||||
@W_58201 var b: Bool = false
|
||||
}
|
||||
|
||||
|
||||
@@ -11,45 +11,45 @@ struct ConcreteP: P, Hashable {}
|
||||
|
||||
// CHECK-LABEL: testBasic
|
||||
dynamic func testBasic() -> some P {
|
||||
// CHECK: underlying_to_opaque_expr{{.*}}'some P'
|
||||
// CHECK-NEXT: call_expr implicit type='AnyP'
|
||||
// CHECK: argument_list implicit labels=erasing:
|
||||
// CHECK-NEXT: argument label=erasing
|
||||
// CHECK-NEXT: call_expr type='ConcreteP'
|
||||
// CHECK: underlying_to_opaque_expr{{.*}}"some P"
|
||||
// CHECK-NEXT: call_expr implicit type="AnyP"
|
||||
// CHECK: argument_list implicit labels="erasing:"
|
||||
// CHECK-NEXT: argument label="erasing"
|
||||
// CHECK-NEXT: call_expr type="ConcreteP"
|
||||
ConcreteP()
|
||||
}
|
||||
|
||||
// CHECK-LABEL: testTypeAlias
|
||||
typealias AliasForP = P
|
||||
dynamic func testTypeAlias() -> some AliasForP {
|
||||
// CHECK: underlying_to_opaque_expr{{.*}}'some P'
|
||||
// CHECK-NEXT: call_expr implicit type='AnyP'
|
||||
// CHECK: argument_list implicit labels=erasing:
|
||||
// CHECK-NEXT: argument label=erasing
|
||||
// CHECK-NEXT: call_expr type='ConcreteP'
|
||||
// CHECK: underlying_to_opaque_expr{{.*}}"some P"
|
||||
// CHECK-NEXT: call_expr implicit type="AnyP"
|
||||
// CHECK: argument_list implicit labels="erasing:"
|
||||
// CHECK-NEXT: argument label="erasing"
|
||||
// CHECK-NEXT: call_expr type="ConcreteP"
|
||||
ConcreteP()
|
||||
}
|
||||
|
||||
// CHECK-LABEL: testNoDynamic
|
||||
func testNoDynamic() -> some P {
|
||||
// CHECK: underlying_to_opaque_expr{{.*}}'some P'
|
||||
// CHECK-NEXT: call_expr type='ConcreteP'
|
||||
// CHECK: underlying_to_opaque_expr{{.*}}"some P"
|
||||
// CHECK-NEXT: call_expr type="ConcreteP"
|
||||
ConcreteP()
|
||||
}
|
||||
|
||||
// CHECK-LABEL: testNoOpaque
|
||||
dynamic func testNoOpaque() -> P {
|
||||
// CHECK: erasure_expr implicit type='any P'
|
||||
// CHECK-NEXT: normal_conformance type=ConcreteP protocol=P
|
||||
// CHECK-NEXT: call_expr type='ConcreteP'
|
||||
// CHECK: erasure_expr implicit type="any P"
|
||||
// CHECK-NEXT: normal_conformance type="ConcreteP" protocol="P"
|
||||
// CHECK-NEXT: call_expr type="ConcreteP"
|
||||
ConcreteP()
|
||||
}
|
||||
|
||||
// CHECK-LABEL: testComposition
|
||||
typealias Composition = P & Hashable
|
||||
dynamic func testComposition() -> some Composition {
|
||||
// CHECK: underlying_to_opaque_expr{{.*}}'some Hashable & P'
|
||||
// CHECK-NEXT: call_expr type='ConcreteP'
|
||||
// CHECK: underlying_to_opaque_expr{{.*}}"some Hashable & P"
|
||||
// CHECK-NEXT: call_expr type="ConcreteP"
|
||||
ConcreteP()
|
||||
}
|
||||
|
||||
@@ -66,11 +66,11 @@ class TestResultBuilder {
|
||||
// CHECK-LABEL: testTransformFnBody
|
||||
@Builder dynamic var testTransformFnBody: some P {
|
||||
// CHECK: return_stmt
|
||||
// CHECK-NEXT: underlying_to_opaque_expr implicit type='some P'
|
||||
// CHECK-NEXT: call_expr implicit type='AnyP'
|
||||
// CHECK: argument_list implicit labels=erasing:
|
||||
// CHECK-NEXT: argument label=erasing
|
||||
// CHECK: declref_expr implicit type='@lvalue ConcreteP'
|
||||
// CHECK-NEXT: underlying_to_opaque_expr implicit type="some P"
|
||||
// CHECK-NEXT: call_expr implicit type="AnyP"
|
||||
// CHECK: argument_list implicit labels="erasing:"
|
||||
// CHECK-NEXT: argument label="erasing"
|
||||
// CHECK: declref_expr implicit type="@lvalue ConcreteP"
|
||||
ConcreteP()
|
||||
}
|
||||
|
||||
@@ -79,14 +79,14 @@ class TestResultBuilder {
|
||||
|
||||
// CHECK-LABEL: testClosureBuilder
|
||||
dynamic var testClosureBuilder: some P {
|
||||
// CHECK: underlying_to_opaque_expr implicit type='some P'
|
||||
// CHECK-NEXT: call_expr implicit type='AnyP'
|
||||
// CHECK: argument_list implicit labels=erasing:
|
||||
// CHECK-NEXT: argument label=erasing
|
||||
// CHECK: closure_expr type='() -> ConcreteP'
|
||||
// CHECK: underlying_to_opaque_expr implicit type="some P"
|
||||
// CHECK-NEXT: call_expr implicit type="AnyP"
|
||||
// CHECK: argument_list implicit labels="erasing:"
|
||||
// CHECK-NEXT: argument label="erasing"
|
||||
// CHECK: closure_expr type="() -> ConcreteP"
|
||||
takesBuilder {
|
||||
// CHECK: return_stmt
|
||||
// CHECK-NEXT: call_expr implicit type='ConcreteP'
|
||||
// CHECK-NEXT: call_expr implicit type="ConcreteP"
|
||||
ConcreteP()
|
||||
}
|
||||
}
|
||||
@@ -95,11 +95,11 @@ class TestResultBuilder {
|
||||
// CHECK-LABEL: class_decl{{.*}}DynamicReplacement
|
||||
class DynamicReplacement {
|
||||
dynamic func testDynamicReplaceable() -> some P {
|
||||
// CHECK: underlying_to_opaque_expr implicit type='some P'
|
||||
// CHECK-NEXT: call_expr implicit type='AnyP'
|
||||
// CHECK: argument_list implicit labels=erasing:
|
||||
// CHECK-NEXT: argument label=erasing
|
||||
// CHECK-NEXT: call_expr type='ConcreteP'
|
||||
// CHECK: underlying_to_opaque_expr implicit type="some P"
|
||||
// CHECK-NEXT: call_expr implicit type="AnyP"
|
||||
// CHECK: argument_list implicit labels="erasing:"
|
||||
// CHECK-NEXT: argument label="erasing"
|
||||
// CHECK-NEXT: call_expr type="ConcreteP"
|
||||
ConcreteP()
|
||||
}
|
||||
}
|
||||
@@ -111,11 +111,11 @@ extension DynamicReplacement {
|
||||
func testDynamicReplacement() -> some P {
|
||||
print("not single expr return")
|
||||
// CHECK: return_stmt
|
||||
// CHECK-NEXT: underlying_to_opaque_expr implicit type='some P'
|
||||
// CHECK-NEXT: call_expr implicit type='AnyP'
|
||||
// CHECK: argument_list implicit labels=erasing:
|
||||
// CHECK-NEXT: argument label=erasing
|
||||
// CHECK-NEXT: call_expr type='ConcreteP'
|
||||
// CHECK-NEXT: underlying_to_opaque_expr implicit type="some P"
|
||||
// CHECK-NEXT: call_expr implicit type="AnyP"
|
||||
// CHECK: argument_list implicit labels="erasing:"
|
||||
// CHECK-NEXT: argument label="erasing"
|
||||
// CHECK-NEXT: call_expr type="ConcreteP"
|
||||
return ConcreteP()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ struct ConcreteP: P, Hashable {}
|
||||
|
||||
// CHECK-LABEL: testTypeErased
|
||||
func testTypeErased() -> some P {
|
||||
// CHECK: underlying_to_opaque_expr{{.*}}'some P'
|
||||
// CHECK-NEXT: call_expr implicit type='AnyP'
|
||||
// CHECK: underlying_to_opaque_expr{{.*}}"some P"
|
||||
// CHECK-NEXT: call_expr implicit type="AnyP"
|
||||
ConcreteP()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@ struct MyBase {
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK-AST: (func_decl implicit "$main()" interface type='(MyBase.Type) -> () throws -> ()' access=internal type
|
||||
// CHECK-AST: (func_decl implicit "$main()" interface type="(MyBase.Type) -> () throws -> ()" access=internal type
|
||||
// CHECK-AST-NEXT: (parameter "self")
|
||||
// CHECK-AST-NEXT: (parameter_list)
|
||||
// CHECK-AST-NEXT: (brace_stmt implicit
|
||||
// CHECK-AST-NEXT: (return_stmt implicit
|
||||
// CHECK-AST-NEXT: (try_expr implicit
|
||||
// CHECK-AST-NEXT: (call_expr implicit type='()'
|
||||
// CHECK-AST-NEXT: (call_expr implicit type="()"
|
||||
|
||||
@@ -7,21 +7,21 @@
|
||||
// Public types with @frozen are always fixed layout
|
||||
//
|
||||
|
||||
// RESILIENCE-ON: struct_decl{{.*}}"Point" interface type='Point.Type' access=public non-resilient
|
||||
// RESILIENCE-OFF: struct_decl{{.*}}"Point" interface type='Point.Type' access=public non-resilient
|
||||
// RESILIENCE-ON: struct_decl{{.*}}"Point" interface type="Point.Type" access=public non_resilient
|
||||
// RESILIENCE-OFF: struct_decl{{.*}}"Point" interface type="Point.Type" access=public non_resilient
|
||||
@frozen public struct Point {
|
||||
let x, y: Int
|
||||
}
|
||||
|
||||
// RESILIENCE-ON: struct_decl{{.*}}"FixedPoint" interface type='FixedPoint.Type' access=public non-resilient
|
||||
// RESILIENCE-OFF: struct_decl{{.*}}"FixedPoint" interface type='FixedPoint.Type' access=public non-resilient
|
||||
// RESILIENCE-ON: struct_decl{{.*}}"FixedPoint" interface type="FixedPoint.Type" access=public non_resilient
|
||||
// RESILIENCE-OFF: struct_decl{{.*}}"FixedPoint" interface type="FixedPoint.Type" access=public non_resilient
|
||||
@_fixed_layout public struct FixedPoint {
|
||||
// expected-warning@-1 {{'@frozen' attribute is now used for fixed-layout structs}}
|
||||
let x, y: Int
|
||||
}
|
||||
|
||||
// RESILIENCE-ON: enum_decl{{.*}}"ChooseYourOwnAdventure" interface type='ChooseYourOwnAdventure.Type' access=public non-resilient
|
||||
// RESILIENCE-OFF: enum_decl{{.*}}"ChooseYourOwnAdventure" interface type='ChooseYourOwnAdventure.Type' access=public non-resilient
|
||||
// RESILIENCE-ON: enum_decl{{.*}}"ChooseYourOwnAdventure" interface type="ChooseYourOwnAdventure.Type" access=public non_resilient
|
||||
// RESILIENCE-OFF: enum_decl{{.*}}"ChooseYourOwnAdventure" interface type="ChooseYourOwnAdventure.Type" access=public non_resilient
|
||||
@frozen public enum ChooseYourOwnAdventure {
|
||||
case JumpIntoRabbitHole
|
||||
case EatMushroom
|
||||
@@ -31,23 +31,23 @@
|
||||
// Public types are resilient when -enable-library-evolution is on
|
||||
//
|
||||
|
||||
// RESILIENCE-ON: struct_decl{{.*}}"Size" interface type='Size.Type' access=public resilient
|
||||
// RESILIENCE-OFF: struct_decl{{.*}}"Size" interface type='Size.Type' access=public non-resilient
|
||||
// RESILIENCE-ON: struct_decl{{.*}}"Size" interface type="Size.Type" access=public resilient
|
||||
// RESILIENCE-OFF: struct_decl{{.*}}"Size" interface type="Size.Type" access=public non_resilient
|
||||
public struct Size {
|
||||
let w, h: Int
|
||||
}
|
||||
|
||||
// RESILIENCE-ON: struct_decl{{.*}}"UsableFromInlineStruct" interface type='UsableFromInlineStruct.Type' access=internal non-resilient
|
||||
// RESILIENCE-OFF: struct_decl{{.*}}"UsableFromInlineStruct" interface type='UsableFromInlineStruct.Type' access=internal non-resilient
|
||||
// RESILIENCE-ON: struct_decl{{.*}}"UsableFromInlineStruct" interface type="UsableFromInlineStruct.Type" access=internal non_resilient
|
||||
// RESILIENCE-OFF: struct_decl{{.*}}"UsableFromInlineStruct" interface type="UsableFromInlineStruct.Type" access=internal non_resilient
|
||||
@frozen @usableFromInline struct UsableFromInlineStruct {}
|
||||
|
||||
// RESILIENCE-ON: struct_decl{{.*}}"UsableFromInlineFixedStruct" interface type='UsableFromInlineFixedStruct.Type' access=internal non-resilient
|
||||
// RESILIENCE-OFF: struct_decl{{.*}}"UsableFromInlineFixedStruct" interface type='UsableFromInlineFixedStruct.Type' access=internal non-resilient
|
||||
// RESILIENCE-ON: struct_decl{{.*}}"UsableFromInlineFixedStruct" interface type="UsableFromInlineFixedStruct.Type" access=internal non_resilient
|
||||
// RESILIENCE-OFF: struct_decl{{.*}}"UsableFromInlineFixedStruct" interface type="UsableFromInlineFixedStruct.Type" access=internal non_resilient
|
||||
@_fixed_layout @usableFromInline struct UsableFromInlineFixedStruct {}
|
||||
// expected-warning@-1 {{'@frozen' attribute is now used for fixed-layout structs}}
|
||||
|
||||
// RESILIENCE-ON: enum_decl{{.*}}"TaxCredit" interface type='TaxCredit.Type' access=public resilient
|
||||
// RESILIENCE-OFF: enum_decl{{.*}}"TaxCredit" interface type='TaxCredit.Type' access=public non-resilient
|
||||
// RESILIENCE-ON: enum_decl{{.*}}"TaxCredit" interface type="TaxCredit.Type" access=public resilient
|
||||
// RESILIENCE-OFF: enum_decl{{.*}}"TaxCredit" interface type="TaxCredit.Type" access=public non_resilient
|
||||
public enum TaxCredit {
|
||||
case EarnedIncome
|
||||
case MortgageDeduction
|
||||
@@ -57,8 +57,8 @@ public enum TaxCredit {
|
||||
// Internal types are always fixed layout
|
||||
//
|
||||
|
||||
// RESILIENCE-ON: struct_decl{{.*}}"Rectangle" interface type='Rectangle.Type' access=internal non-resilient
|
||||
// RESILIENCE-OFF: struct_decl{{.*}}"Rectangle" interface type='Rectangle.Type' access=internal non-resilient
|
||||
// RESILIENCE-ON: struct_decl{{.*}}"Rectangle" interface type="Rectangle.Type" access=internal non_resilient
|
||||
// RESILIENCE-OFF: struct_decl{{.*}}"Rectangle" interface type="Rectangle.Type" access=internal non_resilient
|
||||
struct Rectangle {
|
||||
let topLeft: Point
|
||||
let bottomRight: Size
|
||||
|
||||
@@ -2,30 +2,30 @@
|
||||
|
||||
struct Strukt {
|
||||
// CHECK: (struct_decl {{.*}} "Strukt"
|
||||
// CHECK: (var_decl {{.*}} "dynamicStorageOnlyVar" interface type='Int' access=internal dynamic readImpl=stored writeImpl=stored readWriteImpl=stored
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get_for=dynamicStorageOnlyVar
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic set_for=dynamicStorageOnlyVar
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify_for=dynamicStorageOnlyVar
|
||||
// CHECK: (var_decl {{.*}} "dynamicStorageOnlyVar" interface type="Int" access=internal dynamic readImpl=stored writeImpl=stored readWriteImpl=stored
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get for="dynamicStorageOnlyVar"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic set for="dynamicStorageOnlyVar"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify for="dynamicStorageOnlyVar"
|
||||
dynamic var dynamicStorageOnlyVar : Int = 0
|
||||
|
||||
// CHECK: (var_decl {{.*}} "computedVar" interface type='Int' access=internal dynamic readImpl=getter immutable
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get_for=computedVar
|
||||
// CHECK: (var_decl {{.*}} "computedVar" interface type="Int" access=internal dynamic readImpl=getter immutable
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get for="computedVar"
|
||||
dynamic var computedVar : Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
// CHECK: (var_decl {{.*}} "computedVar2" interface type='Int' access=internal dynamic readImpl=getter immutable
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get_for=computedVar2
|
||||
// CHECK: (var_decl {{.*}} "computedVar2" interface type="Int" access=internal dynamic readImpl=getter immutable
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get for="computedVar2"
|
||||
dynamic var computedVar2 : Int {
|
||||
get {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK: (var_decl {{.*}} "computedVarGetterSetter" interface type='Int' access=internal dynamic readImpl=getter writeImpl=setter readWriteImpl=materialize_to_temporary
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get_for=computedVarGetterSetter
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic set_for=computedVarGetterSetter
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify_for=computedVarGetterSetter
|
||||
// CHECK: (var_decl {{.*}} "computedVarGetterSetter" interface type="Int" access=internal dynamic readImpl=getter writeImpl=setter readWriteImpl=materialize_to_temporary
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get for="computedVarGetterSetter"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic set for="computedVarGetterSetter"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify for="computedVarGetterSetter"
|
||||
dynamic var computedVarGetterSetter : Int {
|
||||
get {
|
||||
return 0
|
||||
@@ -34,10 +34,10 @@ struct Strukt {
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK: (var_decl {{.*}} "computedVarGetterModify" interface type='Int' access=internal dynamic readImpl=getter writeImpl=modify_coroutine readWriteImpl=modify_coroutine
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get_for=computedVarGetterModify
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _modify_for=computedVarGetterModify
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set_for=computedVarGetterModify
|
||||
// CHECK: (var_decl {{.*}} "computedVarGetterModify" interface type="Int" access=internal dynamic readImpl=getter writeImpl=modify_coroutine readWriteImpl=modify_coroutine
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get for="computedVarGetterModify"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _modify for="computedVarGetterModify"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set for="computedVarGetterModify"
|
||||
dynamic var computedVarGetterModify : Int {
|
||||
get {
|
||||
return 0
|
||||
@@ -46,11 +46,11 @@ struct Strukt {
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK: (var_decl {{.*}} "computedVarReadSet" interface type='Int' access=internal dynamic readImpl=read_coroutine writeImpl=setter readWriteImpl=materialize_to_temporary
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _read_for=computedVarReadSet
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic set_for=computedVarReadSet
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get_for=computedVarReadSet
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify_for=computedVarReadSet
|
||||
// CHECK: (var_decl {{.*}} "computedVarReadSet" interface type="Int" access=internal dynamic readImpl=read_coroutine writeImpl=setter readWriteImpl=materialize_to_temporary
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _read for="computedVarReadSet"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic set for="computedVarReadSet"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get for="computedVarReadSet"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify for="computedVarReadSet"
|
||||
dynamic var computedVarReadSet : Int {
|
||||
_read {
|
||||
}
|
||||
@@ -58,11 +58,11 @@ struct Strukt {
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK: (var_decl {{.*}} "computedVarReadModify" interface type='Int' access=internal dynamic readImpl=read_coroutine writeImpl=modify_coroutine readWriteImpl=modify_coroutine
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _read_for=computedVarReadModify
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _modify_for=computedVarReadModify
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get_for=computedVarReadModify
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set_for=computedVarReadModify
|
||||
// CHECK: (var_decl {{.*}} "computedVarReadModify" interface type="Int" access=internal dynamic readImpl=read_coroutine writeImpl=modify_coroutine readWriteImpl=modify_coroutine
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _read for="computedVarReadModify"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _modify for="computedVarReadModify"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get for="computedVarReadModify"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set for="computedVarReadModify"
|
||||
dynamic var computedVarReadModify : Int {
|
||||
_read {
|
||||
}
|
||||
@@ -70,11 +70,11 @@ struct Strukt {
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK: (var_decl {{.*}} "storedWithObserver" interface type='Int' access=internal dynamic readImpl=stored writeImpl=stored_with_observers readWriteImpl=stored_with_didset
|
||||
// CHECK: (accessor_decl {{.*}}access=private dynamic didSet_for=storedWithObserver
|
||||
// CHECK: (accessor_decl {{.*}}access=internal dynamic get_for=storedWithObserver
|
||||
// CHECK: (accessor_decl {{.*}}access=internal set_for=storedWithObserver
|
||||
// CHECK: (accessor_decl {{.*}}access=internal _modify_for=storedWithObserver
|
||||
// CHECK: (var_decl {{.*}} "storedWithObserver" interface type="Int" access=internal dynamic readImpl=stored writeImpl=stored_with_observers readWriteImpl=stored_with_didset
|
||||
// CHECK: (accessor_decl {{.*}}access=private dynamic didSet for="storedWithObserver"
|
||||
// CHECK: (accessor_decl {{.*}}access=internal dynamic get for="storedWithObserver"
|
||||
// CHECK: (accessor_decl {{.*}}access=internal set for="storedWithObserver"
|
||||
// CHECK: (accessor_decl {{.*}}access=internal _modify for="storedWithObserver"
|
||||
dynamic var storedWithObserver : Int {
|
||||
didSet {
|
||||
}
|
||||
@@ -86,9 +86,9 @@ struct Strukt {
|
||||
}
|
||||
|
||||
// CHECK: (subscript_decl {{.*}} "subscript(_:)" {{.*}} access=internal dynamic readImpl=getter writeImpl=setter readWriteImpl=materialize_to_temporary
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic set_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic set for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify for="subscript(_:)"
|
||||
dynamic subscript(_ index: Int) -> Int {
|
||||
get {
|
||||
return 1
|
||||
@@ -98,9 +98,9 @@ struct Strukt {
|
||||
}
|
||||
|
||||
// CHECK: (subscript_decl {{.*}} "subscript(_:)" {{.*}} access=internal dynamic readImpl=getter writeImpl=modify_coroutine readWriteImpl=modify_coroutine
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _modify_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _modify for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set for="subscript(_:)"
|
||||
dynamic subscript(_ index: Float) -> Int {
|
||||
get {
|
||||
return 1
|
||||
@@ -110,10 +110,10 @@ struct Strukt {
|
||||
}
|
||||
|
||||
// CHECK: (subscript_decl {{.*}} "subscript(_:)" {{.*}} access=internal dynamic readImpl=read_coroutine writeImpl=modify_coroutine readWriteImpl=modify_coroutine
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _read_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _modify_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _read for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _modify for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set for="subscript(_:)"
|
||||
dynamic subscript(_ index: Double) -> Int {
|
||||
_read {
|
||||
}
|
||||
@@ -122,10 +122,10 @@ struct Strukt {
|
||||
}
|
||||
|
||||
// CHECK: (subscript_decl {{.*}} "subscript(_:)" {{.*}} access=internal dynamic readImpl=read_coroutine writeImpl=setter readWriteImpl=materialize_to_temporary
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _read_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic set_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _read for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic set for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify for="subscript(_:)"
|
||||
dynamic subscript(_ index: Strukt) -> Int {
|
||||
_read {
|
||||
}
|
||||
@@ -136,30 +136,30 @@ struct Strukt {
|
||||
|
||||
class Klass {
|
||||
// CHECK: (class_decl {{.*}} "Klass"
|
||||
// CHECK: (var_decl {{.*}} "dynamicStorageOnlyVar" interface type='Int' access=internal dynamic readImpl=stored writeImpl=stored readWriteImpl=stored
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get_for=dynamicStorageOnlyVar
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic set_for=dynamicStorageOnlyVar
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify_for=dynamicStorageOnlyVar
|
||||
// CHECK: (var_decl {{.*}} "dynamicStorageOnlyVar" interface type="Int" access=internal dynamic readImpl=stored writeImpl=stored readWriteImpl=stored
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get for="dynamicStorageOnlyVar"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic set for="dynamicStorageOnlyVar"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify for="dynamicStorageOnlyVar"
|
||||
dynamic var dynamicStorageOnlyVar : Int = 0
|
||||
|
||||
// CHECK: (var_decl {{.*}} "computedVar" interface type='Int' access=internal dynamic readImpl=getter immutable
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get_for=computedVar
|
||||
// CHECK: (var_decl {{.*}} "computedVar" interface type="Int" access=internal dynamic readImpl=getter immutable
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get for="computedVar"
|
||||
dynamic var computedVar : Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
// CHECK: (var_decl {{.*}} "computedVar2" interface type='Int' access=internal dynamic readImpl=getter immutable
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get_for=computedVar2
|
||||
// CHECK: (var_decl {{.*}} "computedVar2" interface type="Int" access=internal dynamic readImpl=getter immutable
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get for="computedVar2"
|
||||
dynamic var computedVar2 : Int {
|
||||
get {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK: (var_decl {{.*}} "computedVarGetterSetter" interface type='Int' access=internal dynamic readImpl=getter writeImpl=setter readWriteImpl=materialize_to_temporary
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get_for=computedVarGetterSetter
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic set_for=computedVarGetterSetter
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify_for=computedVarGetterSetter
|
||||
// CHECK: (var_decl {{.*}} "computedVarGetterSetter" interface type="Int" access=internal dynamic readImpl=getter writeImpl=setter readWriteImpl=materialize_to_temporary
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get for="computedVarGetterSetter"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic set for="computedVarGetterSetter"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify for="computedVarGetterSetter"
|
||||
dynamic var computedVarGetterSetter : Int {
|
||||
get {
|
||||
return 0
|
||||
@@ -168,10 +168,10 @@ class Klass {
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK: (var_decl {{.*}} "computedVarGetterModify" interface type='Int' access=internal dynamic readImpl=getter writeImpl=modify_coroutine readWriteImpl=modify_coroutine
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get_for=computedVarGetterModify
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _modify_for=computedVarGetterModify
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set_for=computedVarGetterModify
|
||||
// CHECK: (var_decl {{.*}} "computedVarGetterModify" interface type="Int" access=internal dynamic readImpl=getter writeImpl=modify_coroutine readWriteImpl=modify_coroutine
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get for="computedVarGetterModify"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _modify for="computedVarGetterModify"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set for="computedVarGetterModify"
|
||||
dynamic var computedVarGetterModify : Int {
|
||||
get {
|
||||
return 0
|
||||
@@ -180,11 +180,11 @@ class Klass {
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK: (var_decl {{.*}} "computedVarReadSet" interface type='Int' access=internal dynamic readImpl=read_coroutine writeImpl=setter readWriteImpl=materialize_to_temporary
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _read_for=computedVarReadSet
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic set_for=computedVarReadSet
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get_for=computedVarReadSet
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify_for=computedVarReadSet
|
||||
// CHECK: (var_decl {{.*}} "computedVarReadSet" interface type="Int" access=internal dynamic readImpl=read_coroutine writeImpl=setter readWriteImpl=materialize_to_temporary
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _read for="computedVarReadSet"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic set for="computedVarReadSet"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get for="computedVarReadSet"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify for="computedVarReadSet"
|
||||
dynamic var computedVarReadSet : Int {
|
||||
_read {
|
||||
}
|
||||
@@ -192,11 +192,11 @@ class Klass {
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK: (var_decl {{.*}} "computedVarReadModify" interface type='Int' access=internal dynamic readImpl=read_coroutine writeImpl=modify_coroutine readWriteImpl=modify_coroutine
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _read_for=computedVarReadModify
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _modify_for=computedVarReadModify
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get_for=computedVarReadModify
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set_for=computedVarReadModify
|
||||
// CHECK: (var_decl {{.*}} "computedVarReadModify" interface type="Int" access=internal dynamic readImpl=read_coroutine writeImpl=modify_coroutine readWriteImpl=modify_coroutine
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _read for="computedVarReadModify"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _modify for="computedVarReadModify"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get for="computedVarReadModify"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set for="computedVarReadModify"
|
||||
dynamic var computedVarReadModify : Int {
|
||||
_read {
|
||||
}
|
||||
@@ -214,10 +214,10 @@ class Klass {
|
||||
}
|
||||
|
||||
// CHECK: (subscript_decl {{.*}} "subscript(_:)" {{.*}} access=internal dynamic readImpl=addressor writeImpl=mutable_addressor readWriteImpl=mutable_addressor
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic unsafeAddress_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic unsafeMutableAddress_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic unsafeAddress for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic unsafeMutableAddress for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set for="subscript(_:)"
|
||||
dynamic subscript(_ index: Int) -> Int {
|
||||
unsafeAddress {
|
||||
fatalError()
|
||||
@@ -228,10 +228,10 @@ class Klass {
|
||||
}
|
||||
|
||||
// CHECK: (subscript_decl {{.*}} "subscript(_:)" {{.*}} access=internal dynamic readImpl=getter writeImpl=mutable_addressor readWriteImpl=mutable_addressor
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic unsafeMutableAddress_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic get for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic unsafeMutableAddress for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify for="subscript(_:)"
|
||||
dynamic subscript(_ index: Float) -> Int {
|
||||
get {
|
||||
return 1
|
||||
@@ -242,11 +242,11 @@ class Klass {
|
||||
}
|
||||
|
||||
// CHECK: (subscript_decl {{.*}} "subscript(_:)" {{.*}} access=internal dynamic readImpl=read_coroutine writeImpl=mutable_addressor readWriteImpl=mutable_addressor
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _read_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic unsafeMutableAddress_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _read for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic unsafeMutableAddress for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify for="subscript(_:)"
|
||||
dynamic subscript(_ index: Double) -> Int {
|
||||
_read {
|
||||
}
|
||||
@@ -256,10 +256,10 @@ class Klass {
|
||||
}
|
||||
|
||||
// CHECK: (subscript_decl {{.*}} "subscript(_:)" {{.*}} access=internal dynamic readImpl=addressor writeImpl=setter readWriteImpl=materialize_to_temporary
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic unsafeAddress_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic set_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic unsafeAddress for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic set for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal _modify for="subscript(_:)"
|
||||
dynamic subscript(_ index: Int8) -> Int {
|
||||
unsafeAddress {
|
||||
fatalError()
|
||||
@@ -269,10 +269,10 @@ class Klass {
|
||||
}
|
||||
|
||||
// CHECK: (subscript_decl {{.*}} "subscript(_:)" {{.*}} access=internal dynamic readImpl=addressor writeImpl=modify_coroutine readWriteImpl=modify_coroutine
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic unsafeAddress_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _modify_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set_for=subscript(_:)
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic unsafeAddress for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal dynamic _modify for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal get for="subscript(_:)"
|
||||
// CHECK: (accessor_decl {{.*}} access=internal set for="subscript(_:)"
|
||||
dynamic subscript(_ index: Int16) -> Int {
|
||||
unsafeAddress {
|
||||
fatalError()
|
||||
@@ -285,12 +285,12 @@ class Klass {
|
||||
class SubKlass : Klass {
|
||||
|
||||
// CHECK: (class_decl {{.*}} "SubKlass"
|
||||
// CHECK: (func_decl {{.*}} "aMethod(arg:)" interface type='(SubKlass) -> (Int) -> Int' access=internal {{.*}} dynamic
|
||||
// CHECK: (func_decl {{.*}} "aMethod(arg:)" interface type="(SubKlass) -> (Int) -> Int" access=internal {{.*}} dynamic
|
||||
override dynamic func aMethod(arg: Int) -> Int {
|
||||
return 23
|
||||
}
|
||||
|
||||
// CHECK: (func_decl {{.*}} "anotherMethod()" interface type='(SubKlass) -> () -> Int' access=internal {{.*}} dynamic
|
||||
// CHECK: (func_decl {{.*}} "anotherMethod()" interface type="(SubKlass) -> () -> Int" access=internal {{.*}} dynamic
|
||||
override dynamic func anotherMethod() -> Int {
|
||||
return 23
|
||||
}
|
||||
|
||||
@@ -2319,11 +2319,13 @@ class ClassThrows1 {
|
||||
@objc // access-note-move{{ImplicitClassThrows1}}
|
||||
class ImplicitClassThrows1 {
|
||||
// CHECK: @objc func methodReturnsVoid() throws
|
||||
// CHECK-DUMP: func_decl{{.*}}"methodReturnsVoid()"{{.*}}foreign_error=ZeroResult,unowned,param=0,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
|
||||
// CHECK-DUMP-LABEL: func_decl{{.*}}"methodReturnsVoid()"
|
||||
// CHECK-DUMP: (foreign_error_convention kind=ZeroResult unowned param=0 paramtype="Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>" resulttype="ObjCBool")
|
||||
func methodReturnsVoid() throws { }
|
||||
|
||||
// CHECK: @objc func methodReturnsObjCClass() throws -> Class_ObjC1
|
||||
// CHECK-DUMP: func_decl{{.*}}"methodReturnsObjCClass()" {{.*}}foreign_error=NilResult,unowned,param=0,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>
|
||||
// CHECK-DUMP-LABEL: func_decl{{.*}}"methodReturnsObjCClass()"
|
||||
// CHECK-DUMP: (foreign_error_convention kind=NilResult unowned param=0 paramtype="Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>")
|
||||
func methodReturnsObjCClass() throws -> Class_ObjC1 {
|
||||
return Class_ObjC1()
|
||||
}
|
||||
@@ -2338,11 +2340,13 @@ class ImplicitClassThrows1 {
|
||||
func methodReturnsOptionalObjCClass() throws -> Class_ObjC1? { return nil }
|
||||
|
||||
// CHECK: @objc func methodWithTrailingClosures(_ s: String, fn1: @escaping ((Int) -> Int), fn2: @escaping (Int) -> Int, fn3: @escaping (Int) -> Int)
|
||||
// CHECK-DUMP: func_decl{{.*}}"methodWithTrailingClosures(_:fn1:fn2:fn3:)"{{.*}}foreign_error=ZeroResult,unowned,param=1,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
|
||||
// CHECK-DUMP-LABEL: func_decl{{.*}}"methodWithTrailingClosures(_:fn1:fn2:fn3:)"
|
||||
// CHECK-DUMP: (foreign_error_convention kind=ZeroResult unowned param=1 paramtype="Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>" resulttype="ObjCBool")
|
||||
func methodWithTrailingClosures(_ s: String, fn1: (@escaping (Int) -> Int), fn2: @escaping (Int) -> Int, fn3: @escaping (Int) -> Int) throws { }
|
||||
|
||||
// CHECK: @objc init(degrees: Double) throws
|
||||
// CHECK-DUMP: constructor_decl{{.*}}"init(degrees:)"{{.*}}foreign_error=NilResult,unowned,param=1,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>
|
||||
// CHECK-DUMP-LABEL: constructor_decl{{.*}}"init(degrees:)"
|
||||
// CHECK-DUMP: (foreign_error_convention kind=NilResult unowned param=1 paramtype="Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>")
|
||||
init(degrees: Double) throws { }
|
||||
|
||||
// CHECK: {{^}} func methodReturnsBridgedValueType() throws -> NSRange
|
||||
@@ -2369,7 +2373,8 @@ class ImplicitClassThrows1 {
|
||||
@objc // access-note-move{{SubclassImplicitClassThrows1}}
|
||||
class SubclassImplicitClassThrows1 : ImplicitClassThrows1 {
|
||||
// CHECK: @objc override func methodWithTrailingClosures(_ s: String, fn1: @escaping ((Int) -> Int), fn2: @escaping ((Int) -> Int), fn3: @escaping ((Int) -> Int))
|
||||
// CHECK-DUMP: func_decl{{.*}}"methodWithTrailingClosures(_:fn1:fn2:fn3:)"{{.*}}foreign_error=ZeroResult,unowned,param=1,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
|
||||
// CHECK-DUMP-LABEL: func_decl{{.*}}"methodWithTrailingClosures(_:fn1:fn2:fn3:)"
|
||||
// CHECK-DUMP: (foreign_error_convention kind=ZeroResult unowned param=1 paramtype="Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>" resulttype="ObjCBool")
|
||||
override func methodWithTrailingClosures(_ s: String, fn1: (@escaping (Int) -> Int), fn2: (@escaping (Int) -> Int), fn3: (@escaping (Int) -> Int)) throws { }
|
||||
}
|
||||
|
||||
@@ -2418,20 +2423,24 @@ class ThrowsObjCName {
|
||||
@objc(method7) // bad-access-note-move{{ThrowsObjCName.method7(x:)}} expected-error{{'@objc' method name provides names for 0 arguments, but method has 2 parameters (including the error parameter)}}
|
||||
func method7(x: Int) throws { }
|
||||
|
||||
// CHECK-DUMP: func_decl{{.*}}"method8(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=2,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
|
||||
// CHECK-DUMP-LABEL: func_decl{{.*}}"method8(_:fn1:fn2:)"
|
||||
// CHECK-DUMP: (foreign_error_convention kind=ZeroResult unowned param=2 paramtype="Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>" resulttype="ObjCBool")
|
||||
@objc(method8:fn1:error:fn2:) // access-note-move{{ThrowsObjCName.method8(_:fn1:fn2:)}}
|
||||
func method8(_ s: String, fn1: (@escaping (Int) -> Int), fn2: @escaping (Int) -> Int) throws { }
|
||||
|
||||
// CHECK-DUMP: func_decl{{.*}}"method9(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=0,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
|
||||
// CHECK-DUMP-LABEL: func_decl{{.*}}"method9(_:fn1:fn2:)"
|
||||
// CHECK-DUMP: (foreign_error_convention kind=ZeroResult unowned param=0 paramtype="Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>" resulttype="ObjCBool")
|
||||
@objc(method9AndReturnError:s:fn1:fn2:) // access-note-move{{ThrowsObjCName.method9(_:fn1:fn2:)}}
|
||||
func method9(_ s: String, fn1: (@escaping (Int) -> Int), fn2: @escaping (Int) -> Int) throws { }
|
||||
}
|
||||
|
||||
class SubclassThrowsObjCName : ThrowsObjCName {
|
||||
// CHECK-DUMP: func_decl{{.*}}"method8(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=2,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
|
||||
// CHECK-DUMP-LABEL: func_decl{{.*}}"method8(_:fn1:fn2:)"
|
||||
// CHECK-DUMP: (foreign_error_convention kind=ZeroResult unowned param=2 paramtype="Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>" resulttype="ObjCBool")
|
||||
override func method8(_ s: String, fn1: (@escaping (Int) -> Int), fn2: @escaping (Int) -> Int) throws { }
|
||||
|
||||
// CHECK-DUMP: func_decl{{.*}}"method9(_:fn1:fn2:)"{{.*}}foreign_error=ZeroResult,unowned,param=0,paramtype=Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>,resulttype=ObjCBool
|
||||
// CHECK-DUMP-LABEL: func_decl{{.*}}"method9(_:fn1:fn2:)"
|
||||
// CHECK-DUMP: (foreign_error_convention kind=ZeroResult unowned param=0 paramtype="Optional<AutoreleasingUnsafeMutablePointer<Optional<NSError>>>" resulttype="ObjCBool")
|
||||
override func method9(_ s: String, fn1: (@escaping (Int) -> Int), fn2: @escaping (Int) -> Int) throws { }
|
||||
}
|
||||
|
||||
|
||||
@@ -8,13 +8,15 @@ import Foundation
|
||||
|
||||
// CHECK: class MyClass
|
||||
class MyClass {
|
||||
// CHECK: @objc func doBigJob() async -> Int
|
||||
// CHECK-DUMP: func_decl{{.*}}doBigJob{{.*}}foreign_async=@convention(block) (Int) -> (),completion_handler_param=0
|
||||
@objc func doBigJob() async -> Int { return 0 }
|
||||
// CHECK: @objc func doBigJobClass() async -> Int
|
||||
// CHECK-DUMP-LABEL: func_decl{{.*}}doBigJobClass{{.*}}
|
||||
// CHECK-DUMP: (foreign_async_convention completion_handler_type="@convention(block) (Int) -> ()" completion_handler_param=0)
|
||||
@objc func doBigJobClass() async -> Int { return 0 }
|
||||
|
||||
// CHECK: @objc func doBigJobOrFail(_: Int) async throws -> (AnyObject, Int)
|
||||
// CHECK-DUMP: func_decl{{.*}}doBigJobOrFail{{.*}}foreign_async=@convention(block) (Optional<AnyObject>, Int, Optional<any Error>) -> (),completion_handler_param=1,error_param=2
|
||||
@objc func doBigJobOrFail(_: Int) async throws -> (AnyObject, Int) { return (self, 0) }
|
||||
// CHECK: @objc func doBigJobOrFailClass(_: Int) async throws -> (AnyObject, Int)
|
||||
// CHECK-DUMP-LABEL: func_decl{{.*}}doBigJobOrFailClass{{.*}}
|
||||
// CHECK-DUMP: (foreign_async_convention completion_handler_type="@convention(block) (Optional<AnyObject>, Int, Optional<any Error>) -> ()" completion_handler_param=1 error_param=2)
|
||||
@objc func doBigJobOrFailClass(_: Int) async throws -> (AnyObject, Int) { return (self, 0) }
|
||||
|
||||
@objc func takeAnAsync(_ fn: () async -> Int) { } // expected-error{{method cannot be marked @objc because the type of the parameter cannot be represented in Objective-C}}
|
||||
// expected-note@-1{{'async' function types cannot be represented in Objective-C}}
|
||||
@@ -27,14 +29,16 @@ class MyClass {
|
||||
|
||||
// CHECK: actor MyActor
|
||||
actor MyActor {
|
||||
// CHECK: @objc func doBigJob() async -> Int
|
||||
// CHECK-DUMP: func_decl{{.*}}doBigJob{{.*}}foreign_async=@convention(block) (Int) -> (),completion_handler_param=0
|
||||
@objc func doBigJob() async -> Int { return 0 }
|
||||
// CHECK: @objc func doBigJobActor() async -> Int
|
||||
// CHECK-DUMP-LABEL: func_decl{{.*}}doBigJobActor{{.*}}
|
||||
// CHECK-DUMP: (foreign_async_convention completion_handler_type="@convention(block) (Int) -> ()" completion_handler_param=0)
|
||||
@objc func doBigJobActor() async -> Int { return 0 }
|
||||
|
||||
// CHECK: @objc func doBigJobOrFail(_: Int) async throws -> (AnyObject, Int)
|
||||
// CHECK-DUMP: func_decl{{.*}}doBigJobOrFail{{.*}}foreign_async=@convention(block) (Optional<AnyObject>, Int, Optional<any Error>) -> (),completion_handler_param=1,error_param=2
|
||||
@objc func doBigJobOrFail(_: Int) async throws -> (AnyObject, Int) { return (self, 0) }
|
||||
// expected-warning@-1{{non-sendable type '(AnyObject, Int)' returned by actor-isolated '@objc' instance method 'doBigJobOrFail' cannot cross actor boundary}}
|
||||
// CHECK: @objc func doBigJobOrFailActor(_: Int) async throws -> (AnyObject, Int)
|
||||
// CHECK-DUMP-LABEL: func_decl{{.*}}doBigJobOrFailActor{{.*}}
|
||||
// CHECK-DUMP: (foreign_async_convention completion_handler_type="@convention(block) (Optional<AnyObject>, Int, Optional<any Error>) -> ()" completion_handler_param=1 error_param=2)
|
||||
@objc func doBigJobOrFailActor(_: Int) async throws -> (AnyObject, Int) { return (self, 0) }
|
||||
// expected-warning@-1{{non-sendable type '(AnyObject, Int)' returned by actor-isolated '@objc' instance method 'doBigJobOrFailActor' cannot cross actor boundary}}
|
||||
|
||||
// Actor-isolated entities cannot be exposed to Objective-C.
|
||||
@objc func synchronousBad() { } // expected-error{{actor-isolated instance method 'synchronousBad()' cannot be @objc}}
|
||||
|
||||
@@ -5,7 +5,7 @@ protocol P1 {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: (protocol{{.*}}"P2"
|
||||
// CHECK-NEXT: (associated_type_decl{{.*}}"A" {{.*}} overridden=P1))
|
||||
// CHECK-NEXT: (associated_type_decl{{.*}}"A" {{.*}} overridden="P1"))
|
||||
protocol P2 : P1 {
|
||||
associatedtype A
|
||||
}
|
||||
@@ -15,13 +15,13 @@ protocol P3 {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: (protocol{{.*}}"P4"
|
||||
// CHECK-NEXT: (associated_type_decl{{.*}}"A" {{.*}} overridden=P2, P3))
|
||||
// CHECK-NEXT: (associated_type_decl{{.*}}"A" {{.*}} overridden="P2, P3"))
|
||||
protocol P4 : P2, P3 {
|
||||
associatedtype A
|
||||
}
|
||||
|
||||
// CHECK-LABEL: (protocol{{.*}}"P5"
|
||||
// CHECK-NEXT: (associated_type_decl{{.*}}"A" {{.*}} overridden=P4))
|
||||
// CHECK-NEXT: (associated_type_decl{{.*}}"A" {{.*}} overridden="P4"))
|
||||
protocol P5 : P4, P2 {
|
||||
associatedtype A
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ protocol P0 {
|
||||
// CHECK: protocol{{.*}}"P1"
|
||||
protocol P1: P0 {
|
||||
// CHECK: associated_type_decl
|
||||
// CHECK-SAME: overridden=P0
|
||||
// CHECK-SAME: overridden="P0"
|
||||
associatedtype A
|
||||
|
||||
// CHECK: func_decl{{.*}}foo(){{.*}}Self : P1{{.*}}override={{.*}}P0.foo
|
||||
@@ -25,7 +25,7 @@ protocol P1: P0 {
|
||||
|
||||
// CHECK: var_decl
|
||||
// CHECK-SAME: "prop"
|
||||
// CHECK-SAME: override=override.(file).P0.prop
|
||||
// CHECK-SAME: override="override.(file).P0.prop
|
||||
var prop: A { get }
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ protocol P2 {
|
||||
protocol P3: P1, P2 {
|
||||
// CHECK: associated_type_decl
|
||||
// CHECK-SAME: "A"
|
||||
// CHECK-SAME: override=override.(file).P1.A
|
||||
// CHECK-SAME: override="override.(file).P1.A
|
||||
// CHECK-SAME: override.(file).P2.A
|
||||
associatedtype A
|
||||
|
||||
@@ -51,7 +51,7 @@ protocol P3: P1, P2 {
|
||||
|
||||
// CHECK: var_decl
|
||||
// CHECK-SAME: "prop"
|
||||
// CHECK-SAME: override=override.(file).P2.prop
|
||||
// CHECK-SAME: override="override.(file).P2.prop
|
||||
// CHECK-SAME: override.(file).P1.prop
|
||||
var prop: A { get }
|
||||
}
|
||||
@@ -79,7 +79,7 @@ protocol P5: P0 where Self.A == Int {
|
||||
|
||||
// CHECK: var_decl
|
||||
// CHECK-SAME: "prop"
|
||||
// CHECK-SAME: override=override.(file).P0.prop
|
||||
// CHECK-SAME: override="override.(file).P0.prop
|
||||
var prop: Int { get }
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ protocol P6: P0 {
|
||||
|
||||
// CHECK: var_decl
|
||||
// CHECK-SAME: "prop"
|
||||
// CHECK-SAME: override=override.(file).P0.prop
|
||||
// CHECK-SAME: override="override.(file).P0.prop
|
||||
override var prop: A { get }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// RUN: %target-swift-frontend -typecheck -dump-ast %s | %FileCheck %s
|
||||
|
||||
// Test that covariant 'Self' references get erased to the existential base type
|
||||
// Test that covariant "Self" references get erased to the existential base type
|
||||
// when operating on existential values.
|
||||
|
||||
class C {}
|
||||
@@ -34,11 +34,11 @@ do {
|
||||
let x5 = pc.lotsOfSelfFunc
|
||||
let x6 = pc.lotsOfSelfProp
|
||||
|
||||
// CHECK: (pattern_named type='((any P) -> Void, ((any P)?) -> Void, ([any P]) -> Void, ([Array<any P>?]) -> Void) -> [String : () -> any P]' 'x1')
|
||||
// CHECK: (pattern_named type='((any P) -> Void, ((any P)?) -> Void, ([any P]) -> Void, ([Array<any P>?]) -> Void) -> [String : () -> any P]' 'x2')
|
||||
// CHECK: (pattern_named type='((any P & Q) -> Void, ((any P & Q)?) -> Void, ([any P & Q]) -> Void, ([Array<any P & Q>?]) -> Void) -> [String : () -> any P & Q]' 'x3')
|
||||
// CHECK: (pattern_named type='((any P & Q) -> Void, ((any P & Q)?) -> Void, ([any P & Q]) -> Void, ([Array<any P & Q>?]) -> Void) -> [String : () -> any P & Q]' 'x4')
|
||||
// CHECK: (pattern_named type='((any C & P) -> Void, ((any C & P)?) -> Void, ([any C & P]) -> Void, ([Array<any C & P>?]) -> Void) -> [String : () -> any C & P]' 'x5')
|
||||
// CHECK: (pattern_named type='((any C & P) -> Void, ((any C & P)?) -> Void, ([any C & P]) -> Void, ([Array<any C & P>?]) -> Void) -> [String : () -> any C & P]' 'x6')
|
||||
// CHECK: (pattern_named type="((any P) -> Void, ((any P)?) -> Void, ([any P]) -> Void, ([Array<any P>?]) -> Void) -> [String : () -> any P]" "x1")
|
||||
// CHECK: (pattern_named type="((any P) -> Void, ((any P)?) -> Void, ([any P]) -> Void, ([Array<any P>?]) -> Void) -> [String : () -> any P]" "x2")
|
||||
// CHECK: (pattern_named type="((any P & Q) -> Void, ((any P & Q)?) -> Void, ([any P & Q]) -> Void, ([Array<any P & Q>?]) -> Void) -> [String : () -> any P & Q]" "x3")
|
||||
// CHECK: (pattern_named type="((any P & Q) -> Void, ((any P & Q)?) -> Void, ([any P & Q]) -> Void, ([Array<any P & Q>?]) -> Void) -> [String : () -> any P & Q]" "x4")
|
||||
// CHECK: (pattern_named type="((any C & P) -> Void, ((any C & P)?) -> Void, ([any C & P]) -> Void, ([Array<any C & P>?]) -> Void) -> [String : () -> any C & P]" "x5")
|
||||
// CHECK: (pattern_named type="((any C & P) -> Void, ((any C & P)?) -> Void, ([any C & P]) -> Void, ([Array<any C & P>?]) -> Void) -> [String : () -> any C & P]" "x6")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,21 +13,21 @@ protocol DefaultInit {
|
||||
struct UseWrapper<T: DefaultInit> {
|
||||
// CHECK: var_decl{{.*}}"wrapped"
|
||||
|
||||
// CHECK: accessor_decl{{.*}}get_for=wrapped
|
||||
// CHECK: accessor_decl{{.*}}get for="wrapped"
|
||||
// CHECK: member_ref_expr{{.*}}UseWrapper._wrapped
|
||||
|
||||
// CHECK: accessor_decl{{.*}}set_for=wrapped
|
||||
// CHECK: accessor_decl{{.*}}set for="wrapped"
|
||||
// CHECK: member_ref_expr{{.*}}UseWrapper._wrapped
|
||||
|
||||
// CHECK: accessor_decl{{.*}}_modify_for=wrapped
|
||||
// CHECK: accessor_decl{{.*}}_modify for="wrapped"
|
||||
// CHECK: yield_stmt
|
||||
// CHECK: member_ref_expr{{.*}}Wrapper.wrappedValue
|
||||
@Wrapper
|
||||
var wrapped = T()
|
||||
|
||||
// CHECK: pattern_binding_decl implicit
|
||||
// CHECK-NEXT: pattern_typed implicit type='Wrapper<T>'
|
||||
// CHECK-NEXT: pattern_named implicit type='Wrapper<T>' '_wrapped'
|
||||
// CHECK-NEXT: pattern_typed implicit type="Wrapper<T>"
|
||||
// CHECK-NEXT: pattern_named implicit type="Wrapper<T>" "_wrapped"
|
||||
// CHECK: constructor_ref_call_expr
|
||||
// CHECK-NEXT: declref_expr{{.*}}Wrapper.init(wrappedValue:)
|
||||
init() { }
|
||||
@@ -36,7 +36,7 @@ struct UseWrapper<T: DefaultInit> {
|
||||
struct UseWillSetDidSet {
|
||||
// CHECK: var_decl{{.*}}"z"
|
||||
|
||||
// CHECK: accessor_decl{{.*}}set_for=z
|
||||
// CHECK: accessor_decl{{.*}}set for="z"
|
||||
// CHECK: member_ref_expr{{.*}}UseWillSetDidSet._z
|
||||
@Wrapper
|
||||
var z: Int {
|
||||
@@ -81,10 +81,10 @@ struct Observable<Value> {
|
||||
class MyObservedType {
|
||||
@Observable var observedProperty = 17
|
||||
|
||||
// CHECK: accessor_decl{{.*}}get_for=observedProperty
|
||||
// CHECK: subscript_expr implicit type='@lvalue Int' decl={{.*}}.Observable.subscript(_enclosingInstance:wrapped:storage:)
|
||||
// CHECK: accessor_decl{{.*}}get for="observedProperty"
|
||||
// CHECK: subscript_expr implicit type="@lvalue Int" decl="{{.*}}.Observable.subscript(_enclosingInstance:wrapped:storage:)@
|
||||
|
||||
// CHECK: accessor_decl{{.*}}set_for=observedProperty
|
||||
// CHECK: subscript_expr implicit type='@lvalue Int' decl={{.*}}.Observable.subscript(_enclosingInstance:wrapped:storage:)
|
||||
// CHECK: accessor_decl{{.*}}set for="observedProperty"
|
||||
// CHECK: subscript_expr implicit type="@lvalue Int" decl="{{.*}}.Observable.subscript(_enclosingInstance:wrapped:storage:)@
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// RUN: %target-swift-frontend -dump-ast %s | %FileCheck %s
|
||||
|
||||
// CHECK: func_decl{{.*}}"clone()" interface type='(Android) -> () -> Self'
|
||||
// CHECK: func_decl{{.*}}"clone()" interface type="(Android) -> () -> Self"
|
||||
|
||||
class Android {
|
||||
func clone() -> Self {
|
||||
// CHECK: closure_expr type='() -> Self' {{.*}} discriminator=0 captures=(<dynamic_self> self<direct>)
|
||||
// CHECK: closure_expr type="() -> Self" {{.*}} discriminator=0 captures=(<dynamic_self> self<direct>)
|
||||
let fn = { return self }
|
||||
return fn()
|
||||
}
|
||||
|
||||
@@ -2,33 +2,33 @@
|
||||
|
||||
func doSomething<T>(_ t: T) {}
|
||||
|
||||
// CHECK: func_decl{{.*}}"outerGeneric(t:x:)" <T> interface type='<T> (t: T, x: AnyObject) -> ()'
|
||||
// CHECK: func_decl{{.*}}"outerGeneric(t:x:)" "<T>" interface type="<T> (t: T, x: AnyObject) -> ()"
|
||||
|
||||
func outerGeneric<T>(t: T, x: AnyObject) {
|
||||
// Simple case -- closure captures outer generic parameter
|
||||
// CHECK: closure_expr type='() -> ()' {{.*}} discriminator=0 captures=(<generic> t<direct>) escaping single-expression
|
||||
// CHECK: closure_expr type="() -> ()" {{.*}} discriminator=0 captures=(<generic> t<direct>) escaping single_expression
|
||||
_ = { doSomething(t) }
|
||||
|
||||
// Special case -- closure does not capture outer generic parameters
|
||||
// CHECK: closure_expr type='() -> ()' {{.*}} discriminator=1 captures=(x<direct>) escaping single-expression
|
||||
// CHECK: closure_expr type="() -> ()" {{.*}} discriminator=1 captures=(x<direct>) escaping single_expression
|
||||
_ = { doSomething(x) }
|
||||
|
||||
// Special case -- closure captures outer generic parameter, but it does not
|
||||
// appear as the type of any expression
|
||||
// CHECK: closure_expr type='() -> ()' {{.*}} discriminator=2 captures=(<generic> x<direct>)
|
||||
// CHECK: closure_expr type="() -> ()" {{.*}} discriminator=2 captures=(<generic> x<direct>)
|
||||
_ = { if x is T {} }
|
||||
|
||||
// Nested generic functions always capture outer generic parameters, even if
|
||||
// they're not mentioned in the function body
|
||||
// CHECK: func_decl{{.*}}"innerGeneric(u:)" <U> interface type='<T, U> (u: U) -> ()' {{.*}} captures=(<generic> )
|
||||
// CHECK: func_decl{{.*}}"innerGeneric(u:)" "<U>" interface type="<T, U> (u: U) -> ()" {{.*}} captures=(<generic> )
|
||||
func innerGeneric<U>(u: U) {}
|
||||
|
||||
// Make sure we look through typealiases
|
||||
typealias TT = (a: T, b: T)
|
||||
|
||||
// CHECK: func_decl{{.*}}"localFunction(tt:)" interface type='<T> (tt: TT) -> ()' {{.*}} captures=(<generic> )
|
||||
// CHECK: func_decl{{.*}}"localFunction(tt:)" interface type="<T> (tt: TT) -> ()" {{.*}} captures=(<generic> )
|
||||
func localFunction(tt: TT) {}
|
||||
|
||||
// CHECK: closure_expr type='(TT) -> ()' {{.*}} captures=(<generic> )
|
||||
// CHECK: closure_expr type="(TT) -> ()" {{.*}} captures=(<generic> )
|
||||
let _: (TT) -> () = { _ in }
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ struct S {
|
||||
func foo() -> Int {
|
||||
// Make sure the decl context for the autoclosure passed to ?? is deep
|
||||
// enough that it can 'see' the capture of $0 from the outer closure.
|
||||
// CHECK-LABEL: (lazy_initializer_expr
|
||||
// CHECK-LABEL: (original_init=lazy_initializer_expr
|
||||
// CHECK: (closure_expr
|
||||
// CHECK: location={{.*}}local_lazy.swift:[[@LINE+3]]
|
||||
// CHECK: (autoclosure_expr implicit
|
||||
@@ -17,7 +17,7 @@ struct S {
|
||||
|
||||
extension S {
|
||||
func bar() -> Int {
|
||||
// CHECK-LABEL: (lazy_initializer_expr
|
||||
// CHECK-LABEL: (original_init=lazy_initializer_expr
|
||||
// CHECK: (closure_expr
|
||||
// CHECK: location={{.*}}local_lazy.swift:[[@LINE+3]]
|
||||
// CHECK: (autoclosure_expr implicit
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
// CHECK: func_decl{{.*}}"foo2(_:)"
|
||||
func foo2(_ x: Int) -> (Int) -> (Int) -> Int {
|
||||
// CHECK: closure_expr type='(Int) -> (Int) -> Int' {{.*}} discriminator=0 captures=(x)
|
||||
// CHECK: closure_expr type="(Int) -> (Int) -> Int" {{.*}} discriminator=0 captures=(x)
|
||||
return {(bar: Int) -> (Int) -> Int in
|
||||
// CHECK: closure_expr type='(Int) -> Int' {{.*}} discriminator=0 captures=(x<direct>, bar<direct>)
|
||||
// CHECK: closure_expr type="(Int) -> Int" {{.*}} discriminator=0 captures=(x<direct>, bar<direct>)
|
||||
return {(bas: Int) -> Int in
|
||||
return x + bar + bas
|
||||
}
|
||||
|
||||
@@ -15,12 +15,12 @@ guard let x = Optional(0) else { fatalError() }
|
||||
// CHECK: (top_level_code_decl
|
||||
_ = 0 // intervening code
|
||||
|
||||
// CHECK-LABEL: (func_decl{{.*}}"function()" interface type='() -> ()' access=internal captures=(x<direct>)
|
||||
// CHECK-LABEL: (func_decl{{.*}}"function()" interface type="() -> ()" access=internal captures=(x<direct>)
|
||||
func function() {
|
||||
_ = x
|
||||
}
|
||||
|
||||
// CHECK-LABEL: (closure_expr
|
||||
// CHECK-LABEL: (processed_init=closure_expr
|
||||
// CHECK: location={{.*}}top-level-guard.swift:[[@LINE+3]]
|
||||
// CHECK: captures=(x<direct>)
|
||||
// CHECK: (var_decl{{.*}}"closure"
|
||||
@@ -28,7 +28,7 @@ let closure: () -> Void = {
|
||||
_ = x
|
||||
}
|
||||
|
||||
// CHECK-LABEL: (capture_list
|
||||
// CHECK-LABEL: (processed_init=capture_list
|
||||
// CHECK: location={{.*}}top-level-guard.swift:[[@LINE+5]]
|
||||
// CHECK: (closure_expr
|
||||
// CHECK: location={{.*}}top-level-guard.swift:[[@LINE+3]]
|
||||
@@ -39,7 +39,7 @@ let closureCapture: () -> Void = { [x] in
|
||||
}
|
||||
|
||||
// CHECK-LABEL: (defer_stmt
|
||||
// CHECK-NEXT: (func_decl{{.*}}implicit "$defer()" interface type='() -> ()' access=fileprivate captures=(x<direct><noescape>)
|
||||
// CHECK-NEXT: (func_decl{{.*}}implicit "$defer()" interface type="() -> ()" access=fileprivate captures=(x<direct><noescape>)
|
||||
defer {
|
||||
_ = x
|
||||
}
|
||||
|
||||
@@ -35,26 +35,26 @@ func testDowncastNSArrayToArray(nsarray: NSArray) {
|
||||
|
||||
// CHECK-LABEL: testDowncastOptionalObject
|
||||
func testDowncastOptionalObject(obj: AnyObject?!) -> [String]? {
|
||||
// CHECK: (optional_evaluation_expr implicit type='[String]?'
|
||||
// CHECK-NEXT: (inject_into_optional implicit type='[String]?'
|
||||
// CHECK: (forced_checked_cast_expr type='[String]'{{.*value_cast}}
|
||||
// CHECK: (bind_optional_expr implicit type='AnyObject'
|
||||
// CHECK-NEXT: (force_value_expr implicit type='AnyObject?'
|
||||
// CHECK-NEXT: (declref_expr type='AnyObject??'
|
||||
// CHECK: (optional_evaluation_expr implicit type="[String]?"
|
||||
// CHECK-NEXT: (inject_into_optional implicit type="[String]?"
|
||||
// CHECK: (forced_checked_cast_expr type="[String]"{{.*value_cast}}
|
||||
// CHECK: (bind_optional_expr implicit type="AnyObject"
|
||||
// CHECK-NEXT: (force_value_expr implicit type="AnyObject?"
|
||||
// CHECK-NEXT: (declref_expr type="AnyObject??"
|
||||
return obj as! [String]?
|
||||
}
|
||||
|
||||
// CHECK-LABEL: testDowncastOptionalObjectConditional
|
||||
func testDowncastOptionalObjectConditional(obj: AnyObject?!) -> [String]?? {
|
||||
// CHECK: (optional_evaluation_expr implicit type='[String]??'
|
||||
// CHECK-NEXT: (inject_into_optional implicit type='[String]??'
|
||||
// CHECK-NEXT: (optional_evaluation_expr implicit type='[String]?'
|
||||
// CHECK-NEXT: (inject_into_optional implicit type='[String]?'
|
||||
// CHECK-NEXT: (bind_optional_expr implicit type='[String]'
|
||||
// CHECK-NEXT: (conditional_checked_cast_expr type='[String]?' {{.*value_cast}} writtenType='[String]?'
|
||||
// CHECK-NEXT: (bind_optional_expr implicit type='AnyObject'
|
||||
// CHECK-NEXT: (bind_optional_expr implicit type='AnyObject?'
|
||||
// CHECK-NEXT: (declref_expr type='AnyObject??'
|
||||
// CHECK: (optional_evaluation_expr implicit type="[String]??"
|
||||
// CHECK-NEXT: (inject_into_optional implicit type="[String]??"
|
||||
// CHECK-NEXT: (optional_evaluation_expr implicit type="[String]?"
|
||||
// CHECK-NEXT: (inject_into_optional implicit type="[String]?"
|
||||
// CHECK-NEXT: (bind_optional_expr implicit type="[String]"
|
||||
// CHECK-NEXT: (conditional_checked_cast_expr type="[String]?" {{.*value_cast}} written_type="[String]?"
|
||||
// CHECK-NEXT: (bind_optional_expr implicit type="AnyObject"
|
||||
// CHECK-NEXT: (bind_optional_expr implicit type="AnyObject?"
|
||||
// CHECK-NEXT: (declref_expr type="AnyObject??"
|
||||
return obj as? [String]?
|
||||
}
|
||||
|
||||
|
||||
@@ -40,11 +40,11 @@ let _: S1? = .init(S1())
|
||||
let _: S1? = .init(overloaded: ())
|
||||
// If members exist on Optional and Wrapped, always choose the one on optional
|
||||
// CHECK: declref_expr {{.*}} location={{.*}}optional_overload.swift:40
|
||||
// CHECK-SAME: decl=optional_overload.(file).Optional extension.init(overloaded:)
|
||||
// CHECK-SAME: decl="optional_overload.(file).Optional extension.init(overloaded:)@
|
||||
let _: S1? = .member_overload
|
||||
// Should choose the overload from Optional even if the Wrapped overload would otherwise have a better score
|
||||
// CHECK: member_ref_expr {{.*}} location={{.*}}optional_overload.swift:44
|
||||
// CHECK-SAME: decl=optional_overload.(file).Optional extension.member_overload
|
||||
// CHECK-SAME: decl="optional_overload.(file).Optional extension.member_overload@
|
||||
let _: S1? = .init(failable: ())
|
||||
let _: S1? = .member3()
|
||||
let _: S1? = .member4
|
||||
|
||||
@@ -14,10 +14,10 @@ struct TakesArray<T> {
|
||||
// CHECK-LABEL: func_decl{{.*}}"arrayUpcast(_:_:)"
|
||||
// CHECK: assign_expr
|
||||
// CHECK-NOT: collection_upcast_expr
|
||||
// CHECK: array_expr type='[(X) -> Void]'
|
||||
// CHECK: function_conversion_expr implicit type='(X) -> Void'
|
||||
// CHECK: array_expr type="[(X) -> Void]"
|
||||
// CHECK: function_conversion_expr implicit type="(X) -> Void"
|
||||
// CHECK-NEXT: {{declref_expr.*x1}}
|
||||
// CHECK-NEXT: function_conversion_expr implicit type='(X) -> Void'
|
||||
// CHECK-NEXT: function_conversion_expr implicit type="(X) -> Void"
|
||||
// CHECK-NEXT: {{declref_expr.*x2}}
|
||||
func arrayUpcast(_ x1: @escaping (P) -> Void, _ x2: @escaping (P) -> Void) {
|
||||
_ = TakesArray<X>([x1, x2])
|
||||
@@ -30,9 +30,9 @@ struct TakesDictionary<T> {
|
||||
// CHECK-LABEL: func_decl{{.*}}"dictionaryUpcast(_:_:)"
|
||||
// CHECK: assign_expr
|
||||
// CHECK-NOT: collection_upcast_expr
|
||||
// CHECK: paren_expr type='([Int : (X) -> Void])'
|
||||
// CHECK: paren_expr type="([Int : (X) -> Void])"
|
||||
// CHECK-NOT: collection_upcast_expr
|
||||
// CHECK: (dictionary_expr type='[Int : (X) -> Void]'
|
||||
// CHECK: (dictionary_expr type="[Int : (X) -> Void]"
|
||||
func dictionaryUpcast(_ x1: @escaping (P) -> Void, _ x2: @escaping (P) -> Void) {
|
||||
_ = TakesDictionary<X>(([1: x1, 2: x2]))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user