Opened 5 years ago

Closed 5 years ago

#9415 closed bug (fixed)

Superclass cycle with ambiguous type causes loop

Reported by: goldfire Owned by: goldfire
Priority: normal Milestone: 7.8.4
Component: Compiler Version: 7.8.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: typecheck/should_fail/T9415
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


If I say

class D a => C a where
  meth :: D a => ()
class C a => D a

I get a loop in the typechecker.

I know what's going on here: the error for the superclass cycle is added during the validity check, but then we go on to do ambiguity checks. Unfortunately, the ambiguity check never finishes. We just need to bail when there are superclass errors before doing the ambiguity check.

Patch on the way.

Change History (5)

comment:1 Changed 5 years ago by Richard Eisenberg <eir@…>

In 1b1388697e687154c2bf1943639e75f3ccf5bc59/ghc:

Fix #9415.

Abort typechecking when we detect a superclass cycle error, as
ambiguity checking in the presence of superclass cycle errors can
cause a loop.

comment:2 Changed 5 years ago by Richard Eisenberg <eir@…>

In 1a3e19d061c1e5a1db9789572eca3a0ade450954/ghc:

Test #9415 (typecheck/should_fail/T9415)

comment:3 Changed 5 years ago by goldfire

Milestone: 7.8.4
Status: newmerge
Test Case: typecheck/should_fail/T9415

This is a proper bug with a simple fix and should be merged if we do 7.8.4.

comment:4 Changed 5 years ago by thoughtpolice


Moving (in bulk) to 7.10.4

comment:5 Changed 5 years ago by thoughtpolice

Resolution: fixed
Status: mergeclosed

Merged to 7.8.4

Note: See TracTickets for help on using tickets.