File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed
validation-test/SILGen/SwiftUI Expand file tree Collapse file tree 2 files changed +35
-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 -target %target-cpu-apple-macosx10.15 -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