koka-lang / koka

Koka language compiler and interpreter
http://koka-lang.org
Other
3.16k stars 151 forks source link

Internal error when using raw ctl with named handler #484

Open hflsmax opened 2 months ago

hflsmax commented 2 months ago

I encounter an internal error when using koka 3.1.1

module main

named rec effect get
  ctl get(): ()

pub fun main()
  with r <- named handler
    raw ctl get()
      ()
  ()
> koka -O3 -v0 -o main main.kk
main(1, 1): internal error: label has not kind X: (TCon (TypeCon {typeconName = main/get, typeconKind = KApp (KApp (KCon (->)) (KCon E)) (KApp (KApp (KCon (->)) (KCon V)) (KCon V))}),TVar (TypeVar {typevarId = 196, typevarKind = KCon E, typevarFlavour = Meta}))
CallStack (from HasCallStack):
  error, called at src/Common/Failure.hs:46:12 in koka-3.1.1-BaWBegw2eC62R9E4dpMHh4:Common.Failure
  raise, called at src/Common/Failure.hs:32:5 in koka-3.1.1-BaWBegw2eC62R9E4dpMHh4:Common.Failure
  failure, called at src/Common/Failure.hs:28:11 in koka-3.1.1-BaWBegw2eC62R9E4dpMHh4:Common.Failure
  assertion, called at src/Type/Type.hs:744:5 in koka-3.1.1-BaWBegw2eC62R9E4dpMHh4:Type.Type
  appEffectExtend, called at src/Type/Type.hs:679:14 in koka-3.1.1-BaWBegw2eC62R9E4dpMHh4:Type.Type
  effectExtend, called at src/Type/Infer.hs:1098:57 in koka-3.1.1-BaWBegw2eC62R9E4dpMHh4:Type.Infer

Failed to compile main.kk