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,UInt16etc types were generating invalid IR becauseExpr.projdoesn't work on them. We can work around this by usingUInt8.valetc instead. - The
Floattype needs a further hack becauseFloat.valalso fails; we implement this andFloat.mkusingunsafeCast, which is fine since they are conversions to and fromfloatSpec.floatwhich is an opaque type. instSizeOfNameandName.sizeOfwere manually implemented asnoncomputableso they need acompile_def%. All together this unblocks essentially all the inductive types inLean, and now thetryToCompileAllInductivestest has 1131 / 1134 successes, where the three failures areAcc.below,HEqandAccwhich are all expected because large-eliminating Props are not implemented. (We could special case implement these like withUInt8et al, but these represent a general class of unimplemented inductives whileUInt8is special cased by the code generator.)