You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/expr/postfix/dot/init_ref_delegation.swift
+10-11Lines changed: 10 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -514,29 +514,28 @@ class TestOptionalTrySub : TestOptionalTry {
514
514
structX{init(){}}
515
515
516
516
structY{
517
-
func foo(_:X){}
518
-
func asFunctionReturn()->X{
519
-
vara=X()
520
-
return a.init() // expected-error {{'init' is a member of the type; use 'type(of: ...)' to initialize a new object of the same dynamic type}} {{14-14=type(of: }} {{18-18=)}}
521
-
}
522
517
varx:X
518
+
letx2:X
519
+
523
520
init(){
524
521
x.init() // expected-error {{'init' is a member of the type; use assignment to initalize the value instead}} {{6-6= = }}
525
522
foo(x.init()) // expected-error {{'init' is a member of the type; use 'type(of: ...)' to initialize a new object of the same dynamic type}} {{11-11=type(of: }} {{15-15=)}}
526
523
}
527
-
}
528
-
529
-
structY2{
530
-
varx:X
531
-
init(){
532
-
x =X()
524
+
525
+
func foo(_:X){}
526
+
func asFunctionReturn()->X{
527
+
vara=X()
528
+
return a.init() // expected-error {{'init' is a member of the type; use 'type(of: ...)' to initialize a new object of the same dynamic type}} {{14-14=type(of: }} {{18-18=)}}
533
529
}
534
530
}
535
531
536
532
structMultipleMemberAccesses{
537
533
vary:Y
534
+
lety2:Y
538
535
init(){
539
536
y =Y()
537
+
y2 =Y()
540
538
y.x.init() // expected-error {{'init' is a member of the type; use assignment to initalize the value instead}} {{8-8= = }}
539
+
y2.x2.init() // expected-error {{'init' is a member of the type; use 'type(of: ...)' to initialize a new object of the same dynamic type}} {{11-11=type(of: }} {{15-15=)}}
0 commit comments