Closed dscorbett closed 6 years ago
It's almost certainly a bug in the reachability tracking. In Java simple cases of unreachable code are a compile-time error, which is a PITA for code generators like Snowball and means we need to track reachability and omit code that can't be reached.
Not sure if the Rust language has the same annoying feature, or if the Rust backend just copied the Java one.
Having a look - it's probably something simple. Thanks for the minimal testcase (was there a more complex one you reduced this from that I should also check gets fixed?)
I noticed this while working on the French stemmer but I didn’t save the original full case.
Rust does check for unreachable code. By default, it just prints a warning.
Rust does check for unreachable code. By default, it just prints a warning.
OK, that's probably true of a lot of languages and so it's more widely useful to omit unreachable code, and for interpreted languages it may speed up runtime too, but Java is unusual in it actually being defined to be a compile time error in the language spec, and so actually a hard requirement.
I have a fix for the missing return (which seems to affect all the languages except C and C#, which are the two which don't try to track reachability), but the same testcase currently causes the Python and Javascript backends to segfault, which I ought to address first so I can test the fix for the missing return for those two languages.
The segfault was just lack of a default for the parent class name for those two languages, which I've also pushed a fix for.
The following Snowball code:
produces invalid Java and Rust code: the return statements of
stem
are missing.The Java error is:
The Rust error is: