[tests] Adjusting SR-12869 test cases for optional mismatches

This commit is contained in:
Luciano Almeida
2020-05-24 16:09:19 -03:00
parent 086ad339c9
commit 2e1609e533
2 changed files with 12 additions and 6 deletions

View File

@@ -3367,8 +3367,7 @@ bool ConstraintSystem::repairFailures(
conversionsOrFixes.push_back( conversionsOrFixes.push_back(
IgnoreAssignmentDestinationType::create(*this, lhs, rhs, loc)); IgnoreAssignmentDestinationType::create(*this, lhs, rhs, loc));
} else { } else {
conversionsOrFixes.push_back( conversionsOrFixes.push_back(TreatRValueAsLValue::create(*this, loc));
TreatRValueAsLValue::create(*this, loc));
} }
return true; return true;

View File

@@ -323,8 +323,15 @@ let _ = dupLabelSubscriptStruct[foo: 5, foo: 5] // ok
var dict: [String: (Int, Int)] = [:] var dict: [String: (Int, Int)] = [:]
let bignum: Int64 = 1337 let bignum: Int64 = 1337
dict["test"] = (bignum, 1) // expected-error {{cannot assign value of type '(Int64, Int)' to type '(Int, Int)'}} dict["test"] = (bignum, 1) // expected-error {{cannot assign value of type '(Int64, Int)' to subscript of type '(Int, Int)'}}
// expected-error@-1 {{cannot assign value of type '(Int64, Int)' to subscript of type '(Int, Int)'}}
var tuple: (Int, Int) var tuple: (Int, Int)
tuple = (bignum, 1) // expected-error {{cannot assign value of type '(Int64, Int)' to type '(Int, Int)'}} tuple = (bignum, 1) // expected-error {{cannot assign value of type '(Int64, Int)' to type '(Int, Int)'}}
var optionalTuple: (Int, Int)?
var optionalTuple2: (Int64, Int)? = (bignum, 1)
var optionalTuple3: (UInt64, Int)? = (bignum, 1) // expected-error {{cannot convert value of type '(Int64, Int)' to specified type '(UInt64, Int)?'}}
optionalTuple = (bignum, 1) // expected-error {{cannot assign value of type '(Int64, Int)' to type '(Int, Int)'}}
// Optional to Optional
optionalTuple = optionalTuple2 // expected-error {{cannot assign value of type '(Int64, Int)?' to type '(Int, Int)?'}}