-
Notifications
You must be signed in to change notification settings - Fork 115
Open
Description
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:
struct Foo(n|Ix) = foo : (n=>Float)
table : (Fin 2=>Float) = [1., 2.]
x = (Foo table)
x.foo[0@(Fin 2)]
> 1.
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.
@dougalm help?
Metadata
Metadata
Assignees
Labels
No labels