File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -238,10 +238,9 @@ namespace {
238238 return { false , expr };
239239 }
240240
241- // For exprs of a structural type that are not modeling argument lists,
242- // avoid merging the type variables. (We need to allow for cases like
241+ // For exprs of a tuple, avoid favoring. (We need to allow for cases like
243242 // (Int, Int32).)
244- if (isa<TupleExpr>(expr) && !isa<ApplyExpr>(Parent. getAsExpr ()) ) {
243+ if (isa<TupleExpr>(expr)) {
245244 return { false , expr };
246245 }
247246
Original file line number Diff line number Diff line change @@ -58,3 +58,18 @@ struct S4 {
5858 _ = S4 ( ) // expected-error {{ambiguous use of 'init'}}
5959 }
6060}
61+
62+ infix operator ^^^
63+ func ^^^ ( lhs: ( Int , Int ) , rhs: Int ) -> Int { 0 } // expected-note {{found this candidate}}
64+ func ^^^ ( lhs: ( Int , Int ) , rhs: Int ) -> String { " " } // expected-note {{found this candidate}}
65+
66+ // We shouldn't favor based on the type of a tuple element.
67+ struct S5 {
68+ init ( _ x: Int ) { }
69+ init ( _ x: String ) { }
70+
71+ func testFavoring( ) {
72+ let x = 0
73+ _ = S5 ( ( x, 0 ) ^^^ 0 ) // expected-error {{ambiguous use of operator '^^^'}}
74+ }
75+ }
You can’t perform that action at this time.
0 commit comments