[CSGen] Don't merge type variables for literals in computeFavoredTypeForExpr

This commit is contained in:
Holly Borla
2020-07-22 14:43:05 -07:00
parent df51c4a86f
commit c8e9018c4d
2 changed files with 3 additions and 19 deletions

View File

@@ -8,9 +8,9 @@ func isString(_ s: inout String) {}
func test_UnicodeScalarDoesNotImplementArithmetic(_ us: UnicodeScalar, i: Int) {
var a1 = "a" + "b" // OK
isString(&a1)
let a2 = "a" - "b" // expected-error {{binary operator '-' cannot be applied to two 'String' operands}}
let a3 = "a" * "b" // expected-error {{binary operator '*' cannot be applied to two 'String' operands}}
let a4 = "a" / "b" // expected-error {{binary operator '/' cannot be applied to two 'String' operands}}
let a2 = "a" - "b" // expected-error {{binary operator '-' cannot be applied to two 'String' operands}} expected-note {{}}
let a3 = "a" * "b" // expected-error {{binary operator '*' cannot be applied to two 'String' operands}} expected-note {{}}
let a4 = "a" / "b" // expected-error {{binary operator '/' cannot be applied to two 'String' operands}} expected-note {{}}
let b1 = us + us // expected-error {{binary operator '+' cannot be applied to two 'UnicodeScalar' (aka 'Unicode.Scalar') operands}}
let b2 = us - us // expected-error {{binary operator '-' cannot be applied to two 'UnicodeScalar' (aka 'Unicode.Scalar') operands}}