@@ -2513,9 +2513,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
2513
2513
auto opaque1 = cast<OpaqueTypeArchetypeType>(desugar1);
2514
2514
auto opaque2 = cast<OpaqueTypeArchetypeType>(desugar2);
2515
2515
2516
- assert (!type2->is <LValueType>() && " Unexpected lvalue type!" );
2517
- if (!type1->is <LValueType>()
2518
- && opaque1->getDecl () == opaque2->getDecl ()) {
2516
+ if (opaque1->getDecl () == opaque2->getDecl ()) {
2519
2517
conversionsOrFixes.push_back (ConversionRestrictionKind::DeepEquality);
2520
2518
}
2521
2519
break ;
@@ -2529,15 +2527,13 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
2529
2527
auto rootOpaque1 = dyn_cast<OpaqueTypeArchetypeType>(nested1->getRoot ());
2530
2528
auto rootOpaque2 = dyn_cast<OpaqueTypeArchetypeType>(nested2->getRoot ());
2531
2529
if (rootOpaque1 && rootOpaque2) {
2532
- assert (!type2->is <LValueType>() && " Unexpected lvalue type!" );
2533
2530
auto interfaceTy1 = nested1->getInterfaceType ()
2534
2531
->getCanonicalType (rootOpaque1->getGenericEnvironment ()
2535
2532
->getGenericSignature ());
2536
2533
auto interfaceTy2 = nested2->getInterfaceType ()
2537
2534
->getCanonicalType (rootOpaque2->getGenericEnvironment ()
2538
2535
->getGenericSignature ());
2539
- if (!type1->is <LValueType>()
2540
- && interfaceTy1 == interfaceTy2
2536
+ if (interfaceTy1 == interfaceTy2
2541
2537
&& rootOpaque1->getDecl () == rootOpaque2->getDecl ()) {
2542
2538
conversionsOrFixes.push_back (ConversionRestrictionKind::DeepEquality);
2543
2539
break ;
@@ -2556,7 +2552,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
2556
2552
// T1 is convertible to T2 (by loading the value). Note that we cannot get
2557
2553
// a value of inout type as an lvalue though.
2558
2554
if (type1->is <LValueType>() && !type2->is <InOutType>()) {
2559
- return matchTypes (type1->getRValueType (), type2,
2555
+ return matchTypes (type1->getWithoutSpecifierType (), type2,
2560
2556
kind, subflags, locator);
2561
2557
}
2562
2558
}
@@ -2613,7 +2609,6 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
2613
2609
// We can remove this special case when we implement operator hiding.
2614
2610
if (!type1->is <LValueType>() &&
2615
2611
kind != ConstraintKind::OperatorArgumentConversion) {
2616
- assert (!type2->is <LValueType>() && " Unexpected lvalue type!" );
2617
2612
conversionsOrFixes.push_back (
2618
2613
ConversionRestrictionKind::HashableToAnyHashable);
2619
2614
}
@@ -2676,16 +2671,13 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
2676
2671
if (!type1->is <LValueType>() && kind >= ConstraintKind::Subtype) {
2677
2672
// Array -> Array.
2678
2673
if (isArrayType (desugar1) && isArrayType (desugar2)) {
2679
- assert (!type2->is <LValueType>() && " Unexpected lvalue type!" );
2680
2674
conversionsOrFixes.push_back (ConversionRestrictionKind::ArrayUpcast);
2681
2675
// Dictionary -> Dictionary.
2682
2676
} else if (isDictionaryType (desugar1) && isDictionaryType (desugar2)) {
2683
- assert (!type2->is <LValueType>() && " Unexpected lvalue type!" );
2684
2677
conversionsOrFixes.push_back (
2685
2678
ConversionRestrictionKind::DictionaryUpcast);
2686
2679
// Set -> Set.
2687
2680
} else if (isSetType (desugar1) && isSetType (desugar2)) {
2688
- assert (!type2->is <LValueType>() && " Unexpected lvalue type!" );
2689
2681
conversionsOrFixes.push_back (
2690
2682
ConversionRestrictionKind::SetUpcast);
2691
2683
}
0 commit comments