Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Can't compile Garrett/Pindah (negate operator problem) #246

Open
troyhen opened this Issue Feb 21, 2014 · 6 comments

Comments

Projects
None yet
3 participants

troyhen commented Feb 21, 2014

I'm simply trying to compile Garrett for Pindah. I get the following error:

Compiling...
./org/example/hello/HelloActivity.mirah
./org/example/hello/HelloActivity.mirah:38: undefined method compile' for #<Jav a::MirahLangAst::NodeList:0x2a6446c9> @vx = -(Math.abs(@vx)) ^^^^^^^^^^^^^^^^ C:/jruby-1.7.10/lib/ruby/gems/shared/gems/rake-10.1.1/lib/rake/task.rb:185 warni ng: singleton on non-persistent Java type Java::OrgApacheToolsAnt::BuildExceptio n (http://wiki.jruby.org/Persistence) rake aborted! org.jruby.exceptions.RaiseException: (NoMethodError) undefined methodcompile'
for #Java::MirahLangAst::NodeList:0x2a6446c9
org.mirah.ant.Compile.execute(compile.mirah:77)
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
org.apache.tools.ant.Task.perform(Task.java:348)
org.apache.tools.ant.Target.execute(Target.java:435)
org.apache.tools.ant.Target.performTasks(Target.java:456)
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
org.apache.tools.ant.Project.executeTarget(Project.java:1364)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.ja
va:455)
org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:316)
org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:61
)
org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:61)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326
)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:206)
org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:194)
org.jruby.runtime.Interpreted19Block.call(Interpreted19Block.java:125)
org.jruby.runtime.Block.call(Block.java:101)
org.jruby.RubyProc.call(RubyProc.java:290)
org.jruby.RubyProc.call19(RubyProc.java:271)
org.jruby.RubyProc$INVOKER$i$0$0$call19.call(RubyProc$INVOKER$i$0$0$call19.gen)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:218)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:214)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:346
)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:204)
org.jruby.ast.CallTwoArgNode.interpret(CallTwoArgNode.java:59)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.CaseNode.interpret(CaseNode.java:137)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:206)
org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:157)
org.jruby.runtime.Block.yield(Block.java:142)
org.jruby.RubyArray.eachCommon(RubyArray.java:1606)
org.jruby.RubyArray.each(RubyArray.java:1613)
org.jruby.RubyArray$INVOKER$i$0$0$each.call(RubyArray$INVOKER$i$0$0$each.gen)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:316
)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:145)
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:154)
org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:64)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java
:182)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:198)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326
)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
org.jruby.ast.IfNode.interpret(IfNode.java:116)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:206)
org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:157)
org.jruby.runtime.Interpreted19Block.yieldSpecific(Interpreted19Block.java:130)
org.jruby.runtime.Block.yieldSpecific(Block.java:111)
org.jruby.ast.ZYieldNode.interpret(ZYieldNode.java:25)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96)
org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java
:161)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:190)
org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:81)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:316
)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:145)
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:154)
org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:64)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.ast.RescueNode.executeBody(RescueNode.java:221)
org.jruby.ast.RescueNode.interpret(RescueNode.java:116)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java
:225)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:214)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:346
)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:204)
org.jruby.ast.FCallTwoArgNode.interpret(FCallTwoArgNode.java:38)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java
:139)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:182)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306
)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136)
org.jruby.ast.CallSpecialArgNode.interpret(CallSpecialArgNode.java:65)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java
:182)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:198)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326
)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:206)
org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:157)
org.jruby.runtime.Block.yield(Block.java:142)
org.jruby.RubyArray.eachCommon(RubyArray.java:1606)
org.jruby.RubyArray.each(RubyArray.java:1613)
org.jruby.RubyArray$INVOKER$i$0$0$each.call(RubyArray$INVOKER$i$0$0$each.gen)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:316
)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:145)
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:154)
org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:64)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.IfNode.interpret(IfNode.java:118)
org.jruby.ast.IfNode.interpret(IfNode.java:118)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:206)
org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:157)
org.jruby.runtime.Interpreted19Block.yieldSpecific(Interpreted19Block.java:130)
org.jruby.runtime.Block.yieldSpecific(Block.java:111)
org.jruby.ast.ZYieldNode.interpret(ZYieldNode.java:25)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java
:161)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:190)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:316
)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:145)
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:154)
org.jruby.ast.FCallNoArgBlockNode.interpret(FCallNoArgBlockNode.java:32)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java
:139)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:182)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306
)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136)
org.jruby.ast.VCallNode.interpret(VCallNode.java:88)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:206)
org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:157)
org.jruby.runtime.Interpreted19Block.yieldSpecific(Interpreted19Block.java:130)
org.jruby.runtime.Block.yieldSpecific(Block.java:111)
org.jruby.ast.ZYieldNode.interpret(ZYieldNode.java:25)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.RescueNode.executeBody(RescueNode.java:221)
org.jruby.ast.RescueNode.interpret(RescueNode.java:116)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java
:161)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:190)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:316
)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:145)
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:154)
org.jruby.ast.FCallNoArgBlockNode.interpret(FCallNoArgBlockNode.java:32)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java
:139)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:182)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306
)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136)
org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:60)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.ast.RootNode.interpret(RootNode.java:129)
org.jruby.evaluator.ASTInterpreter.INTERPRET_ROOT(ASTInterpreter.java:121)
org.jruby.Ruby.runInterpreter(Ruby.java:838)
org.jruby.Ruby.loadFile(Ruby.java:2750)
org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:66)
org.jruby.runtime.load.LoadService.load(LoadService.java:359)
org.jruby.RubyKernel.loadCommon(RubyKernel.java:1107)
org.jruby.RubyKernel.load19(RubyKernel.java:1099)
org.jruby.RubyKernel$INVOKER$s$0$1$load19.call(RubyKernel$INVOKER$s$0$1$load19.g
en)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:210)
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:206)
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326
)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
C_3a_.jruby_minus_1_dot_7_dot_10.bin.rake.file(C:\jruby-1.7.10\bin\rake:23)
C_3a_.jruby_minus_1_dot_7_dot_10.bin.rake.load(C:\jruby-1.7.10\bin\rake)
org.jruby.Ruby.runScript(Ruby.java:811)
org.jruby.Ruby.runScript(Ruby.java:804)
org.jruby.Ruby.runNormally(Ruby.java:673)
org.jruby.Ruby.runFromMain(Ruby.java:522)
org.jruby.Main.doRunFromMain(Main.java:395)
org.jruby.Main.internalRun(Main.java:290)
org.jruby.Main.run(Main.java:217)
org.jruby.Main.main(Main.java:197)

troyhen commented Feb 21, 2014

The problem goes away if I change every leading minus (-x) to a subtraction (0 - x). It looks like the problem is with the leading negate operator.

troyhen commented Feb 21, 2014

I'm using mirah 0.1.2 and pindah 0.1.3.

Hi, @troyhen.

Out of curiosity, what versions of Mirah and Pindah were you using in your tests?

Given it's age, I'm kinda surprised Garrett still compiles and runs with the latest versions of Mirah and Pindah! That said, I seem to recall encountering a similar "bug" while using a recent version of Mirah on Android.

Perhaps @baroquebobcat or @ribrdb can speak to the particulars.

troyhen commented Feb 21, 2014

I actually added that as a comment to the issue, but it's 0.1.2 of mirah
and 0.1.3 of pindah.

Troy

On Thu, Feb 20, 2014 at 10:11 PM, Adam Parrott notifications@github.comwrote:

Hi, @troyhen https://github.com/troyhen.

Out of curiosity, what versions of Mirah and Pindah were you using in your
tests?

Reply to this email directly or view it on GitHubhttps://github.com/mirah/mirah/issues/246#issuecomment-35699795
.

troyhen commented Feb 21, 2014

Just to be more clear, I don't believe this has anything to do with either Android or pindah. I Just happened to be compiling a file that contains several uses of the unary negate operator. Mirah doesn't handle that at the moment. But I'm hoping it is a simple fix.

@baroquebobcat baroquebobcat added the parser label Sep 3, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment