I still can't wrap my head around how to fix this, but here's a reduced case that should at least show what the root of the problem is. Basically, isScalar and closureOf circularly depend on each other in a subtle way.
Fixed. I didn't realize before that the obvious fix (making isScalar check for nominal instead of structural type) actually worked but an unrelated problem in an old beta was causing compilation to fail.
I still can't wrap my head around how to fix this, but here's a reduced case that should at least show what the root of the problem is. Basically, isScalar and closureOf circularly depend on each other in a subtle way.