File tree Expand file tree Collapse file tree 3 files changed +57
-1
lines changed
validation-test/SILGen/SwiftUI Expand file tree Collapse file tree 3 files changed +57
-1
lines changed Original file line number Diff line number Diff line change @@ -1502,7 +1502,7 @@ class SILGenApply : public Lowering::ExprVisitor<SILGenApply> {
15021502 SILType loweredResultTy;
15031503 auto selfMetaTy = selfValue.getType ().getAs <AnyMetatypeType>();
15041504 if (selfMetaTy) {
1505- loweredResultTy = SILType::getPrimitiveObjectType (
1505+ loweredResultTy = SGF. getLoweredLoadableType (
15061506 CanMetatypeType::get (resultTy, selfMetaTy->getRepresentation ()));
15071507 } else {
15081508 loweredResultTy = SGF.getLoweredLoadableType (resultTy);
Original file line number Diff line number Diff line change 1+ // RUN: %target-swift-emit-silgen %s
2+
3+ // https://github.com/swiftlang/swift/issues/68277
4+
5+ enum E : P {
6+ static func m( ) -> some Any { ( ) }
7+ }
8+
9+ protocol P {
10+ associatedtype A
11+ static func m( ) -> A
12+ }
13+
14+ struct S < T> {
15+ let t : T
16+ }
17+
18+ extension S where T == E . A {
19+ init ( ) {
20+ self . init ( t: E . m ( ) )
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ // RUN: %target-swift-emit-silgen %s -target %target-cpu-apple-macosx11 -swift-version 5
2+
3+ // REQUIRES: objc_interop
4+ // REQUIRES: OS=macosx
5+
6+ import SwiftUI
7+
8+ protocol StaticFactory {
9+ associatedtype Result
10+
11+ func callAsFunction( ) -> Self . Result
12+ }
13+
14+ struct ViewFactory : StaticFactory {
15+ let systemName : String
16+
17+ func callAsFunction( ) -> some View {
18+ Image ( systemName: systemName)
19+ . frame ( width: 20 , height: 20 )
20+ }
21+ }
22+
23+ extension Button where Label == ViewFactory . Result {
24+ init (
25+ systemName: String ,
26+ action: @escaping ( ) -> Void
27+ ) {
28+ self . init (
29+ action: action
30+ ) {
31+ ViewFactory ( systemName: systemName) ( )
32+ }
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments