private CType simpleType() {
...
// if more then one, first try to exclude those internal to other pods
if (types.size > 1) types = types.exclude |t| { t.isInternal && t.pod.name != compiler.pod.name }
// if more then one its ambiguous (use errReport to avoid suppression)
if (types.size > 1)
errReport(CompilerErr("Ambiguous type: " + types.join(", "), loc))
// got it
return types.first // <-- line 2207
}
If all the types are internal to other pods then types becomes empty and types.first returns null resulting in the NullErr.
So my solution was to re-compile the compiler, adding the following to Parser.simpleType():
private CType simpleType() {
...
// if more then one, first try to exclude those internal to other pods
if (types.size > 1) types = types.exclude |t| { t.isInternal && t.pod.name != compiler.pod.name }
// ---- PATCH START ----
// all types were internal to other pods
if (types.isEmpty)
throw err("Unknown type '$id'", loc)
// ---- PATCH END ------
// if more then one its ambiguous (use errReport to avoid suppression)
if (types.size > 1)
errReport(CompilerErr("Ambiguous type: " + types.join(", "), loc))
// got it
return types.first
}
Before integrating that patch I'd also like to get a test case that reproduces it we can add to the testCompiler suite. What did the code look like that caused that? I can't make it happen
SlimerDudeSun 26 Oct 2014
What did the code look like that caused that?
Oh yeah, I forgot to add the important stuff!
If you install IoC then the following reproduces the null Err
using afIoc
using afPlastic
class Which {
Void main() {
Utils.getLog(this.typeof)
}
}
SlimerDude Mon 6 Oct 2014
Hi, when compiling a project today I ran into this:
Which wasn't very helpful!
The
Parser code
in question looks like:If all the types are internal to other pods then
types
becomes empty andtypes.first
returnsnull
resulting in theNullErr
.So my solution was to re-compile the compiler, adding the following to
Parser.simpleType()
:and now I get the following sane error msg:
Hooray!
brian Mon 20 Oct 2014
Before integrating that patch I'd also like to get a test case that reproduces it we can add to the testCompiler suite. What did the code look like that caused that? I can't make it happen
SlimerDude Sun 26 Oct 2014
Oh yeah, I forgot to add the important stuff!
If you install IoC then the following reproduces the null Err
Just run it as a script:
Both IoC and Plastic have a
Utils
class with agetLog()
method.SlimerDude Mon 9 Feb 2015
Hi, I ran into this issue again today.
I re-patched my
compiler::Parser
class with the code in the first post and now I get:The line causing the compilation error was:
With
ErrMsgs
being an internal class in bothafIocConfig
andafButter
.brian Mon 9 Feb 2015
Yeah with that info I was able to reproduce it too. Thanks. Pushed a fix