Skip to content

Commit 545b178

Browse files
committed
only merge comparable types after checking all subparts
This fixes a bug that has been reported in the error message catalog a bunch of times: - elm/error-message-catalog#208 - elm/error-message-catalog#272 - elm/error-message-catalog#274 - elm/error-message-catalog#285 - elm/error-message-catalog#287
1 parent 0a89b62 commit 545b178

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

compiler/src/Type/Unify.hs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -391,13 +391,13 @@ unifyFlexSuperStructure context super flatType =
391391

392392
Comparable ->
393393
do comparableOccursCheck context
394-
merge context (Structure flatType)
395394
unifyComparableRecursive variable
395+
merge context (Structure flatType)
396396

397397
CompAppend ->
398398
do comparableOccursCheck context
399-
merge context (Structure flatType)
400399
unifyComparableRecursive variable
400+
merge context (Structure flatType)
401401

402402
Tuple1 a b maybeC ->
403403
case super of
@@ -409,15 +409,12 @@ unifyFlexSuperStructure context super flatType =
409409

410410
Comparable ->
411411
do comparableOccursCheck context
412-
merge context (Structure flatType)
413412
unifyComparableRecursive a
414413
unifyComparableRecursive b
415414
case maybeC of
416-
Nothing ->
417-
return ()
418-
419-
Just c ->
420-
unifyComparableRecursive c
415+
Nothing -> return ()
416+
Just c -> unifyComparableRecursive c
417+
merge context (Structure flatType)
421418

422419
CompAppend ->
423420
mismatch

0 commit comments

Comments
 (0)