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
func find( _:Snack)->Snack{} // expected-error {{function declares an opaque return type, but has no return statements in its body from which to infer an underlying type}}
54
+
func find()->Eatery{} // expected-error {{function declares an opaque return type, but has no return statements in its body from which to infer an underlying type}}
47
55
48
-
// tuple types
49
-
func list(_:(Meal,Meal)){}
56
+
func find()->AnyObject{
57
+
returnCoffeeShop() // expected-error {{return expression of type 'CoffeeBar' expected to be an instance of a class or class-constrained type}}
58
+
}
50
59
51
-
funchighestRated()->(Eatery,Eatery){
52
-
return(Best(),TopTier())
60
+
funcfind()->Any{
61
+
returnCoffeeShop()
53
62
}
54
63
55
-
func highestRated()->(someSnack,someSnack){} // expected-error {{function declares an opaque return type, but has no return statements in its body from which to infer an underlying type}}
64
+
// tuple types
65
+
func highestRated()->(Eatery,Eatery){} // expected-error {{function declares an opaque return type, but has no return statements in its body from which to infer an underlying type}}
56
66
57
-
// opaque compostion types
58
-
funcfind()->Shop&Cafe{
59
-
returnCoffeeBar()
67
+
// type alias
68
+
funcinspect( _ snack:someSnack)->someSnack{
69
+
returnCoffeeShop();
60
70
}
71
+
// tuple type alias
72
+
func highestRated()->(someSnack,someSnack){} // expected-error {{function declares an opaque return type, but has no return statements in its body from which to infer an underlying type}}
61
73
62
-
func find()->AnyObject{
63
-
returnCoffeeBar() // expected-error {{Return expression of type 'CoffeeBar' expected to be an instance of a class or class-constrained type}}
64
-
}
74
+
// TO-DO: Fix type alias for plain protocols; resolves as an existential type
75
+
func list(_:(Meal,Meal))->(Meal,Meal){}
76
+
func find()->Snack{}
65
77
66
-
func find()->Any{
67
-
returnCoffeeBar()
68
-
}
78
+
// opaque compostion types
79
+
func search()->Shop&Cafe{} // expected-error {{function declares an opaque return type, but has no return statements in its body from which to infer an underlying type}}
0 commit comments