Skip to content

ASSERT failed! file typecheck/TcMType.lhs line 517

This is exposed by running the testsuite on a stage2 compiler with -DDEBUG. The tests triggering it are:

  • gadt/equal
  • gadt/set
  • gadt/termination
  • gadt/tc
  • gadt/while

The affected context is the ASSERTM2 in:

writeMetaTyVar :: TcTyVar -> TcType -> TcM ()
writeMetaTyVar tyvar ty
  | not debugIsOn = writeMutVar (metaTvRef tyvar) (Indirect ty)
writeMetaTyVar tyvar ty
  | not (isMetaTyVar tyvar)
  = pprTrace "writeMetaTyVar" (ppr tyvar) $
    return ()
  | otherwise
  = ASSERT( isMetaTyVar tyvar )
    -- TOM: It should also work for coercions
    -- ASSERT2( k2 `isSubKind` k1, (ppr tyvar <+> ppr k1) $$ (ppr ty <+> ppr k2) )
    do	{ ASSERTM2( do { details <- readMetaTyVar tyvar; return (isFlexi details) }, ppr tyvar )
	; writeMutVar (metaTvRef tyvar) (Indirect ty) }
  where
    _k1 = tyVarKind tyvar
    _k2 = typeKind ty

The precise error is:

=====> while(normal)
cd . && '/Users/mbolingbroke/Programming/Checkouts/ghc.working/compiler/stage2/ghc-inplace' -fforce-recomp -dcore-lint -dcmm-lint -Di386_apple_darwin  -dno-debug-output -o while while.hs    >while.comp.stderr 2>&1
Compile failed (status 256) errors were:
ghc-6.9.20080614: panic! (the 'impossible' happened)
  (GHC version 6.9.20080614 for i386-apple-darwin):
	ASSERT failed! file typecheck/TcMType.lhs line 517 t_aAZ{tv} [tau]
Trac metadata
Trac field Value
Version 6.9
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system MacOS X
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information