Skip to content

Commit 0cade0e

Browse files
committed
chore: work around old compiler bug
1 parent 4984438 commit 0cade0e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Lean/Compiler/MetaAttr.lean

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ def getIRPhases (env : Environment) (declName : Name) : IRPhases := Id.run do
2727
if !env.header.isModule then
2828
return .all
2929
match env.getModuleIdxFor? declName with
30-
| some idx => if isMeta env declName then .comptime else env.header.modules[idx.toNat]?.map (·.irPhases) |>.get!
30+
| some idx => if isMeta env declName then .comptime else
31+
-- HACK: The old compiler gets the ABI wrong if the result is not an immediate
32+
-- constructor. The `match` can be removed once the new compiler is enabled.
33+
match env.header.modules[idx.toNat]?.map (·.irPhases) |>.get! with
34+
| .comptime => .comptime
35+
| .runtime => .runtime
36+
| .all => .all
3137
-- Allow `meta`->non-`meta` acesses in the same module
3238
| none => if isMeta env declName then .comptime else .all
3339

0 commit comments

Comments
 (0)