tact icon indicating copy to clipboard operation
tact copied to clipboard

Expand `reduceBool` and add `reduceSlice`

Open Gusarich opened this issue 1 year ago • 2 comments

resolves #195

I didn't cover that with new tests yet, going to do it soon

Gusarich avatar Mar 27 '24 08:03 Gusarich

Current implementation doesn't actually work and throws errors on compiling new test cases. I'll investigate the problem and try to fix it.

Gusarich avatar Mar 27 '24 17:03 Gusarich

The issue here is that constant evaluation is performed on a non-typechecked AST. So when you call getExpType to dispatch on the type of == / != operators, there is no actual type information. The proper fix here would be to refactor the compiler to perform constant evaluation after typechecking (and to actually do this refactoring we need a new type describing typed ASTs).

anton-trunov avatar Apr 15 '24 05:04 anton-trunov

Looks like this PR should be closed now? Because the architecture of the constant evaluator has changed a lot in #432. Of course, we can still improve a lot of things in the constant evaluator, adding support for slices would be especially nice.

anton-trunov avatar Jun 19 '24 08:06 anton-trunov

yes, right

Gusarich avatar Jun 19 '24 08:06 Gusarich