Re: looks like a compiler bug?

2018-08-25 Thread MG
Wouldn't it be easier/better to require stuff like that (which will be a programming error in 99.999...% of cases) require an e.g. @LenientMode annotation to not raise a compilation error (wherever that error is located) ? class Foo {   @LenientMod   void baz() { return 42 } // compiles &

Re: looks like a compiler bug?

2018-08-25 Thread ocs@ocs
Paul, thanks for elucidation! Incidentally, as for the runtime — in my personal opinion the point is in that void is void is void, i.e., whilst void foo() { return 42 } should be an error (I'd rather vote for compile-time, though it of course is arguable whether not to move it to runtime),

Re: looks like a compiler bug?

2018-08-24 Thread Paul King
I think you are correct that we should do this differently. In fact, there is a comment along those lines in the code: https://github.com/apache/groovy/blob/master/src/main/java/org/codehaus/groovy/classgen/asm/StatementWriter.java#L601 You wouldn't want the check too early so that AST

looks like a compiler bug?

2018-08-24 Thread ocs@ocs
Ladies and gentlemen, I've just bumped into the problem shown below. Whilst it is arguable whether the situation should be valid or not (myself, I strongly believe it should be valid and compiled without a glitch), even if invalid, it should not cause an uncaught exception, but simply report a