on master help sign in
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: - https://github.com/elm/error-message-catalog/issues/208 - https://github.com/elm/error-message-catalog/issues/272 - https://github.com/elm/error-message-catalog/issues/274 - https://github.com/elm/error-message-catalog/issues/285 - https://github.com/elm/error-message-catalog/issues/287

commit545b1784695500e822c2d044b6b5ed2ab6689552 authorEvan Czaplicki <evancz@users.noreply.github.com> dateFri 26 Jul 2019, 11:09 (7 years ago) parent0a89b62
1 file changed+5−8
compiler/src/Type/Unify.hs+5−8
compiler/src/Type/Unify.hs+5−8
@@ -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