on master help sign in
Detect kernel variables in canonicalization
9eb1ab6Evan Czaplicki
src/Canonicalize/Expression.hs+9−1
@@ -639,7 +639,15 @@ findVar :: R.Region -> Env.Env -> Maybe N.Name -> N.Name -> Result FreeLocals w
639findVar region (Env.Env localHome vars _ _ _) maybePrefix name =
639findVar region (Env.Env localHome vars _ _ _) maybePrefix name =
640 case Map.lookup name vars of
640 case Map.lookup name vars of
641 Nothing ->
641 Nothing ->
642+ case maybePrefix of
643+ Nothing ->
644+ Result.throw (error "TODO no name" region)
645+
646+ Just prefix ->
647+ if ModuleName.isKernel prefix then
648+ Result.ok $ Can.VarKernel (ModuleName.getKernel prefix) name
649+ else
642− Result.throw (error "TODO no name" region)
650+ Result.throw (error "TODO no name" region)
643
651
644 Just (Env.VarHomes unqualified qualified) ->
652 Just (Env.VarHomes unqualified qualified) ->
645 case maybePrefix of
653 case maybePrefix of