Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Lean/Compiler/IR/Checker.lean
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ def checkExpr (ty : IRType) (e : Expr) : M Unit := do
checkObjVar x
| .proj i x =>
let xType ← getType x;
/-
Projections are a valid operation on `tobject`. Thus they should also
be a valid operation for both `object`, `tagged` and unboxed values
as they are subtypes.
-/
match xType with
| .object | .tobject =>
checkObjType ty
Expand All @@ -167,6 +172,7 @@ def checkExpr (ty : IRType) (e : Expr) : M Unit := do
checkEqTypes (tys[i]) ty
else
throwCheckerError "invalid proj index"
| .tagged => pure ()
| _ => throwCheckerError s!"unexpected IR type '{xType}'"
| .uproj _ x =>
checkObjVar x
Expand Down
Loading