chore: share more code in toIRType (#9115)
This commit is contained in:
parent
cd60e3b8fd
commit
52ab0141cd
1 changed files with 8 additions and 9 deletions
|
|
@ -56,22 +56,21 @@ def toIRType (e : Lean.Expr) : CoreM IRType := do
|
|||
| ``Float => return .float
|
||||
| ``Float32 => return .float32
|
||||
| ``lcErased => return .irrelevant
|
||||
| _ =>
|
||||
if let some scalarType ← lowerEnumToScalarType? name then
|
||||
return scalarType
|
||||
else
|
||||
return .object
|
||||
| _ => nameToIRType name
|
||||
| .app f _ =>
|
||||
-- All mono types are in headBeta form.
|
||||
if let .const name _ := f then
|
||||
if let some scalarType ← lowerEnumToScalarType? name then
|
||||
return scalarType
|
||||
else
|
||||
return .object
|
||||
nameToIRType name
|
||||
else
|
||||
return .object
|
||||
| .forallE .. => return .object
|
||||
| _ => panic! "invalid type"
|
||||
where
|
||||
nameToIRType name := do
|
||||
if let some scalarType ← lowerEnumToScalarType? name then
|
||||
return scalarType
|
||||
else
|
||||
return .object
|
||||
|
||||
inductive CtorFieldInfo where
|
||||
| irrelevant
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue