Skip to content

Commit 298a84a

Browse files
committed
RequirementMachine: Preserve sugar in desugarSameTypeRequirement()
1 parent 01a254f commit 298a84a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/AST/RequirementMachine/RequirementLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ static void desugarSameTypeRequirement(Type lhs, Type rhs, SourceLoc loc,
7373

7474
if (secondType->isTypeParameter()) {
7575
result.emplace_back(RequirementKind::SameType,
76-
secondType, firstType);
76+
secondType, sugaredFirstType);
7777
recordedRequirements = true;
7878
return true;
7979
}
8080

8181
errors.push_back(
82-
RequirementError::forConcreteTypeMismatch(firstType,
82+
RequirementError::forConcreteTypeMismatch(sugaredFirstType,
8383
secondType,
8484
loc));
8585
recordedErrors = true;

test/Generics/requirement_machine_diagnostics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ typealias NotAnInt = Double
1919

2020
protocol X {}
2121

22-
// expected-error@+1{{generic signature requires types 'Double' and 'Int' to be the same}}
22+
// expected-error@+1{{generic signature requires types 'NotAnInt' (aka 'Double') and 'Int' to be the same}}
2323
extension X where NotAnInt == Int {}
2424

2525
protocol EqualComparable {

0 commit comments

Comments
 (0)