This is a minimization of the problem @emilyfertig encountered in #1332. The chain of interactions is to make a table, make a struct containing that table, then access that field of the struct and try to index the table. Oddly, if we do all of these steps at the top level, it works fine:
But if we make the struct construction local, we get a compiler error:
:p
y = (Foo table)
y.foo[0@(Fin 2)]
> Compiler bug!
> Please report this at github.com/google-research/dex-lang/issues
>
> Unexpected table: table
> CallStack (from HasCallStack):
> error, called at src/lib/Simplify.hs:570:22 in dex-0.1.0.0-Gi9B8TxRbicLQnuTnmjlXJ:Simplify
That line number is in simplifyTabApp, which can't handle the table being a Var that's not wrapped in SimpInCore, which is what, in this example, it is getting.
This is a minimization of the problem @emilyfertig encountered in #1332. The chain of interactions is to make a table, make a struct containing that table, then access that field of the struct and try to index the table. Oddly, if we do all of these steps at the top level, it works fine:
But if we make the struct construction local, we get a compiler error:
That line number is in
simplifyTabApp
, which can't handle the table being aVar
that's not wrapped inSimpInCore
, which is what, in this example, it is getting.@dougalm help?