CozySynthesizer / cozy

The collection synthesizer
https://cozy.uwplse.org
Apache License 2.0
209 stars 18 forks source link

Generated `sum` code not indented #16

Closed seizethedave closed 6 years ago

seizethedave commented 7 years ago

For this spec: https://github.com/CozySynthesizer/lucene-solr/blob/fe9f54505747fb98922dfd672b42519d2080057a/lucene/highlighter/src/java/org/apache/lucene/search/highlight/TokenGroupBase.ds

This code is generated: https://github.com/CozySynthesizer/lucene-solr/blob/fe9f54505747fb98922dfd672b42519d2080057a/lucene/highlighter/src/java/org/apache/lucene/search/highlight/TokenGroupBase.java#L168

I'm not using sum directly in the spec but a sum is being generated, and its implementation is not indented.

Calvin-L commented 7 years ago

Is it causing any functional issues?

Simple-mode often does some very silly things, computing values in weird and excessively-complicated ways. I wouldn't worry about this too much unless (1) it still appears after a full synthesis run or (2) it is causing an observable misbehavior in the generated code.

Calvin-L commented 7 years ago

Rereading my last comment, past-me clearly didn't understand the issue here.

Regarding indentation: some part of codegen isn't correctly threading the indent parameter through. The easiest way to debug this is to remove the default-argument from the def visit_EUnaryOp(self, e, indent="") line, let the thing break, then fix the caller in the stacktrace. The offending line will look like self.visit(e) (with no indent parameter given).