ericmckean / traceur-compiler

Automatically exported from code.google.com/p/traceur-compiler
Apache License 2.0
0 stars 0 forks source link

Need test coverage for tree.typeAnnotation !== null #187

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When VariableDeclaration constructor was change to add typeAnnotation as the 
third argument, old code that passed the initializer third caused declarations 
with no initializer but a type annotation to be created. This in turn caused 
ParseTreeWriter to fail because we have no test coverage for declarations with 
typeAnnotations.

I don't understand typeAnnotations, so I don't plan to fix this one.

Original issue reported on code.google.com by johnjbar...@chromium.org on 20 Dec 2012 at 4:37

GoogleCodeExporter commented 9 years ago
What code is failing?

This is easy to fix, just pass a null as the type annotation.

Original comment by arv@chromium.org on 20 Dec 2012 at 5:48

GoogleCodeExporter commented 9 years ago
No code failed during test because no test entered:
    if (tree.typeAnnotation !== null) {
      this.write_(TokenType.COLON);
      this.visitAny(tree.typeAnnotation);
    }
and
    if (tree.moduleName) {
      this.visitAny(tree.moduleName);
      this.write_(TokenType.PERIOD);
    }
These blocks use TokenType fields which no longer exist. These bugs are fixed 
in issue 188, but I opened this issue to remind us to include coverage in the 
test suite for these cases.

Original comment by johnjbar...@chromium.org on 20 Dec 2012 at 5:21

GoogleCodeExporter commented 9 years ago
I see what is going on here. I think we have very limited coverage of the 
ParseTreeWriter, especially for trees that we always transform away.

I think one thing we could do is to take the feature test scripts, parse them, 
write them to a string and parse that string and compare the two different 
trees. This is similar to the test you are writing for the tree clone 
transformer.

Original comment by arv@chromium.org on 20 Dec 2012 at 5:25

GoogleCodeExporter commented 9 years ago
I have a simple test harness to round-trip the feature test files.

Currently 13 are failing. Should have a fix tomorrow.

Original comment by peter...@google.com on 21 Dec 2012 at 1:48