@@ -33,7 +33,7 @@ object HandlerLowering:
3333
3434 private case class LinkState (res : Local , cls : Path , uid : Path )
3535
36- type FnOrCls = Either [BlockMemberSymbol , MemberSymbol [? <: ClassLikeDef ] & InnerSymbol ]
36+ type FnOrCls = Either [BlockMemberSymbol , DefinitionSymbol [? <: ClassLikeDef ] & InnerSymbol ]
3737
3838 // isTopLevel:
3939 // whether the current block is the top level block, as we do not emit code for continuation class on the top level
@@ -132,7 +132,7 @@ class HandlerLowering(paths: HandlerPaths, opt: EffectHandlers)(using TL, Raise,
132132 def apply (res : Local , uid : StateId , rest : Block ) =
133133 Assign (res, PureCall (Value .Ref (resumptionSymbol), List (Value .Lit (Tree .IntLit (uid)))), rest)
134134 def unapply (blk : Block ) = blk match
135- case Assign (res, PureCall (Value .Ref (`resumptionSymbol`), List (Value .Lit (Tree .IntLit (uid)))), rest) =>
135+ case Assign (res, PureCall (Value .Ref (`resumptionSymbol`, _ ), List (Value .Lit (Tree .IntLit (uid)))), rest) =>
136136 Some (res, uid, rest)
137137 case _ => None
138138
@@ -141,7 +141,7 @@ class HandlerLowering(paths: HandlerPaths, opt: EffectHandlers)(using TL, Raise,
141141 def apply (res : Local , uid : StateId ) =
142142 Assign (res, PureCall (Value .Ref (returnContSymbol), List (Value .Lit (Tree .IntLit (uid)))), End (" " ))
143143 def unapply (blk : Block ) = blk match
144- case Assign (res, PureCall (Value .Ref (`returnContSymbol`), List (Value .Lit (Tree .IntLit (uid)))), _) =>
144+ case Assign (res, PureCall (Value .Ref (`returnContSymbol`, _ ), List (Value .Lit (Tree .IntLit (uid)))), _) =>
145145 Some (res, uid)
146146 case _ => None
147147
@@ -157,7 +157,7 @@ class HandlerLowering(paths: HandlerPaths, opt: EffectHandlers)(using TL, Raise,
157157 def unapply (blk : Block ) = blk match
158158 case Assign (
159159 res,
160- PureCall (Value .Ref (`callSymbol`), List (Value .Lit (Tree .IntLit (uid)))),
160+ PureCall (Value .Ref (`callSymbol`, _ ), List (Value .Lit (Tree .IntLit (uid)))),
161161 Assign (_, c, rest)) =>
162162 Some (res, uid, c, rest)
163163 case _ => None
@@ -167,15 +167,15 @@ class HandlerLowering(paths: HandlerPaths, opt: EffectHandlers)(using TL, Raise,
167167 def apply (uid : StateId ) =
168168 Return (PureCall (Value .Ref (transitionSymbol), List (Value .Lit (Tree .IntLit (uid)))), false )
169169 def unapply (blk : Block ) = blk match
170- case Return (PureCall (Value .Ref (`transitionSymbol`), List (Value .Lit (Tree .IntLit (uid)))), false ) =>
170+ case Return (PureCall (Value .Ref (`transitionSymbol`, _ ), List (Value .Lit (Tree .IntLit (uid)))), false ) =>
171171 S (uid)
172172 case _ => N
173173
174174 object FnEnd :
175175 private val fnEndSymbol = freshTmp(" fnEnd" )
176176 def apply () = Return (PureCall (Value .Ref (fnEndSymbol), Nil ), false )
177177 def unapply (blk : Block ) = blk match
178- case Return (PureCall (Value .Ref (`fnEndSymbol`), Nil ), false ) => true
178+ case Return (PureCall (Value .Ref (`fnEndSymbol`, _ ), Nil ), false ) => true
179179 case _ => false
180180
181181 private class FreshId :
@@ -522,7 +522,7 @@ class HandlerLowering(paths: HandlerPaths, opt: EffectHandlers)(using TL, Raise,
522522 ResultPlaceholder (res, freshId(), c2, k(Value .Ref (res)))
523523 case r => super .applyResult(r)(k)
524524 override def applyPath (p : Path )(k : Path => Block ): Block = p match
525- case Value .Ref (`getLocalsSym`) => k(handlerCtx.debugInfo.prevLocalsFn.get)
525+ case Value .Ref (`getLocalsSym`, _ ) => k(handlerCtx.debugInfo.prevLocalsFn.get)
526526 case _ => super .applyPath(p)(k)
527527 override def applyLam (lam : Lambda ): Lambda =
528528 // This should normally be unreachable due to prior desugaring of lambda
@@ -591,7 +591,7 @@ class HandlerLowering(paths: HandlerPaths, opt: EffectHandlers)(using TL, Raise,
591591 f.owner match
592592 case None => S (Call (f.sym.asPath, params)(true , true ))
593593 case Some (owner) =>
594- S (Call (Select (owner.asPath, Tree .Ident (f.sym.nme))(S (f.sym) ), params)(true , true ))
594+ S (Call (Select (owner.asPath, Tree .Ident (f.sym.nme))(N ), params)(true , true ))
595595 case _ => None // TODO: more than one plist
596596
597597 FunDefn (f.owner, f.sym, f.params, translateBlock(f.body,
@@ -657,7 +657,7 @@ class HandlerLowering(paths: HandlerPaths, opt: EffectHandlers)(using TL, Raise,
657657 handler.sym, handler.params,
658658 Define (
659659 fDef,
660- Return (PureCall (paths.mkEffectPath, h.cls.asPath :: Value .Ref (sym) :: Nil ), false )))
660+ Return (PureCall (paths.mkEffectPath, h.cls.asPath :: Value .Ref (sym, N ) :: Nil ), false )))
661661
662662 // Some limited handling of effects extending classes and having access to their fields.
663663 // Currently does not support super() raising effects.
@@ -687,7 +687,7 @@ class HandlerLowering(paths: HandlerPaths, opt: EffectHandlers)(using TL, Raise,
687687
688688 val body = blockBuilder
689689 .define(clsDefn)
690- .assign(h.lhs, Instantiate (mut = true , Value .Ref (clsDefn.sym), Nil ))
690+ .assign(h.lhs, Instantiate (mut = true , Value .Ref (clsDefn.sym, S (h.cls) ), Nil ))
691691 .rest(handlerBody)
692692
693693 val defn = FunDefn (
@@ -735,7 +735,7 @@ class HandlerLowering(paths: HandlerPaths, opt: EffectHandlers)(using TL, Raise,
735735 val transform = new BlockTransformerShallow (SymbolSubst ()):
736736 override def applyResult (r : Result )(k : Result => Block ): Block =
737737 r match
738- case c @ Call (Value .Ref (s : BuiltinSymbol ), _) => ()
738+ case c @ Call (Value .Ref (s : BuiltinSymbol , _ ), _) => ()
739739 case c : Call if ! c.mayRaiseEffects => ()
740740 case _ : Call | _ : Instantiate => containsCall = true
741741 case _ => ()
@@ -792,7 +792,8 @@ class HandlerLowering(paths: HandlerPaths, opt: EffectHandlers)(using TL, Raise,
792792 override def applyBlock (b : Block ): Block = b match
793793 case ReturnCont (res, uid) => Return (Call (
794794 Select (clsSym.asPath, Tree .Ident (" doUnwind" ))(
795- N /* this refers to the method defined in Runtime.FunctionContFrame */ ),
795+ N /* this refers to the method defined in Runtime.FunctionContFrame */
796+ ),
796797 res.asPath.asArg :: Value .Lit (Tree .IntLit (uid)).asArg :: Nil )(true , false ),
797798 false
798799 )
0 commit comments