Commit 2023-06-23 04:45 e0d81340
View on Github →fix: compile inductives recursively (#5039)
The compileSizeOf
addition inadvertently broke the tryToCompileAllInductives
test (which is disabled on master because it is too expensive); if you actually run it there are hundreds of failures (421 / 1134
success), where it should only have failed a small handful of times. The reason for the failure is that compiling a T.sizeOf
function requires U.rec
and U.sizeOf
if the definition of inductive type T
uses U
, so now we process them recursively.
In addition there are a few more fixes for completeness:
- The
UInt8
,UInt16
etc types were generating invalid IR becauseExpr.proj
doesn't work on them. We can work around this by usingUInt8.val
etc instead. - The
Float
type needs a further hack becauseFloat.val
also fails; we implement this andFloat.mk
usingunsafeCast
, which is fine since they are conversions to and fromfloatSpec.float
which is an opaque type. instSizeOfName
andName.sizeOf
were manually implemented asnoncomputable
so they need acompile_def%
. All together this unblocks essentially all the inductive types inLean
, and now thetryToCompileAllInductives
test has 1131 / 1134 successes, where the three failures areAcc.below
,HEq
andAcc
which are all expected because large-eliminating Props are not implemented. (We could special case implement these like withUInt8
et al, but these represent a general class of unimplemented inductives whileUInt8
is special cased by the code generator.)