Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalArgumentException: Not an OCaml node: Element(OCAML_LAZY_NODE) #329

Closed
soid opened this issue May 27, 2021 · 10 comments
Closed

IllegalArgumentException: Not an OCaml node: Element(OCAML_LAZY_NODE) #329

soid opened this issue May 27, 2021 · 10 comments

Comments

@soid
Copy link

soid commented May 27, 2021

plugin version: 0.100-2021.1

Description

When typing in .mll file, the plugin throws an exception (in IntelliJ) and prevents text being typed.

The exception:

update failed for AnAction(com.intellij.find.actions.FindUsagesAction) with ID=FindUsages

java.lang.IllegalArgumentException: Not an OCaml node: Element(OCAML_LAZY_NODE) (OCAML_LAZY_NODE, Language: OCaml)
	at com.reason.lang.ocaml.OclParserDefinition.createElement(OclParserDefinition.java:80)
	at com.intellij.psi.impl.source.tree.CompositeElement.createPsiNoLock(CompositeElement.java:705)
	at com.intellij.psi.impl.source.tree.CompositeElement.getPsi(CompositeElement.java:692)
	at com.intellij.psi.impl.source.SourceTreeToPsiMap.treeElementToPsi(SourceTreeToPsiMap.java:16)
	at com.intellij.psi.impl.source.tree.SharedImplUtil.getNextSibling(SharedImplUtil.java:46)
	at com.intellij.psi.impl.source.tree.LeafPsiElement.getNextSibling(LeafPsiElement.java:75)
	at com.intellij.psi.AbstractFileViewProvider.findReferenceAt(AbstractFileViewProvider.java:235)
	at com.intellij.psi.SingleRootFileViewProvider.findReferenceAt(SingleRootFileViewProvider.java:224)
	at com.intellij.psi.impl.source.PsiFileImpl.findReferenceAt(PsiFileImpl.java:526)
	at com.intellij.codeInsight.TargetElementUtilBase.findReference(TargetElementUtilBase.java:189)
	at com.intellij.codeInsight.TargetElementUtil.findReference(TargetElementUtil.java:93)
	at com.intellij.model.psi.impl.TargetsKt.fromTargetEvaluator(targets.kt:169)
	at com.intellij.model.psi.impl.TargetsKt.declarationsOrReferences(targets.kt:138)
	at com.intellij.model.psi.impl.TargetsKt.declaredReferencedData(targets.kt:43)
	at com.intellij.model.psi.impl.TargetsKt.targetSymbols(targets.kt:24)
	at com.intellij.find.usages.impl.ImplKt.searchTargets(impl.kt:21)
	at com.intellij.find.actions.ResolverKt.searchTargets(resolver.kt:93)
	at com.intellij.find.actions.FindUsagesInFileAction.isEnabled(FindUsagesInFileAction.java:88)
	at com.intellij.find.actions.FindUsagesInFileAction.updateFindUsagesAction(FindUsagesInFileAction.java:114)
	at com.intellij.find.actions.FindUsagesAction.update(FindUsagesAction.java:67)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.lambda$performDumbAwareUpdate$1(ActionUtil.java:170)
	at com.intellij.util.SlowOperations.lambda$allowSlowOperations$0(SlowOperations.java:77)
	at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:64)
	at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:76)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareUpdate(ActionUtil.java:176)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater.doUpdate(ActionUpdater.java:510)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater.lambda$new$1(ActionUpdater.java:104)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater.callAction(ActionUpdater.java:147)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater.lambda$new$2(ActionUpdater.java:105)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater.update(ActionUpdater.java:492)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater.expandGroupChild(ActionUpdater.java:333)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater.lambda$doExpandActionGroup$20(ActionUpdater.java:308)
	at com.intellij.util.TimeoutUtil.compute(TimeoutUtil.java:134)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater.lambda$doExpandActionGroup$22(ActionUpdater.java:307)
	at com.intellij.util.containers.ContainerUtil.concat(ContainerUtil.java:1511)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater.doExpandActionGroup(ActionUpdater.java:307)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater.expandActionGroup(ActionUpdater.java:199)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater.expandActionGroup(ActionUpdater.java:173)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater.lambda$expandActionGroupWithTimeout$11(ActionUpdater.java:215)
	at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:57)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:178)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:688)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:634)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:64)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:165)
	at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:57)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.withTimeout(ProgressIndicatorUtils.java:310)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater.expandActionGroupWithTimeout(ActionUpdater.java:215)
	at com.intellij.openapi.actionSystem.impl.ActionUpdater.expandActionGroupWithTimeout(ActionUpdater.java:207)
	at com.intellij.openapi.actionSystem.impl.Utils.expandActionGroup(Utils.java:105)
	at com.intellij.ui.mac.touchbar.BuildUtils.addActionGroupButtons(BuildUtils.java:121)
	at com.intellij.ui.mac.touchbar.BuildUtils.buildFromCustomizedGroup(BuildUtils.java:82)
	at com.intellij.ui.mac.touchbar.ProjectData._fillBarContainer(ProjectData.java:242)
	at com.intellij.ui.mac.touchbar.ProjectData.get(ProjectData.java:124)
	at com.intellij.ui.mac.touchbar.TouchBarsManager.lambda$registerProject$1(TouchBarsManager.java:145)
	at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:218)
	at com.intellij.openapi.application.TransactionGuardImpl.access$200(TransactionGuardImpl.java:21)
	at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:200)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:781)
	at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeLater$4(ApplicationImpl.java:319)
	at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:84)
	at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:133)
	at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:46)
	at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:189)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:969)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:839)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:449)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:808)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:781)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:496)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

How to reproduce:

  1. Download skeleton: http://www.cs.columbia.edu/~sedwards/classes/2021/4115-spring/hw1.tar.gz
  2. Edit scanner.mll. Try typing | VAR { Var($1) } in the end of the file.
@giraud
Copy link
Owner

giraud commented May 27, 2021

file not found
image

@soid
Copy link
Author

soid commented May 27, 2021

Not sure why, I just checked from 2 different computers located in the US and Europe without any cookies - the file seems to be available. Can you try one more time? Alternatively, I can email the file to you, but I'd like to avoid re-publishing it elsewhere.

@giraud
Copy link
Owner

giraud commented May 27, 2021

ok I'll try when my vpn for work is down.

@giraud
Copy link
Owner

giraud commented May 27, 2021

nope, still no luck

@soid
Copy link
Author

soid commented May 27, 2021

Very strange, sorry about it! Would email work? Please shoot me an email at soid.exe at gmail and I'll send the file.

@giraud
Copy link
Owner

giraud commented May 28, 2021

you can create a repo in git, it's easier

giraud added a commit that referenced this issue Jun 9, 2021
@JoAllg
Copy link

JoAllg commented Aug 24, 2021

@giraud

I get a similar (Intellj) exception when having a non empty .mly file in use:

java.lang.IllegalArgumentException: Not an OCaml node: Element(OCAML_LAZY_NODE) (OCAML_LAZY_NODE, Language: OCaml):  None 
	at com.reason.lang.ocaml.OclParserDefinition.createElement(OclParserDefinition.java:80)
	at com.intellij.psi.impl.source.tree.CompositeElement.createPsiNoLock(CompositeElement.java:705)
	at com.intellij.psi.impl.source.tree.CompositeElement.getPsi(CompositeElement.java:692)
	at com.intellij.psi.impl.source.SourceTreeToPsiMap.treeElementToPsi(SourceTreeToPsiMap.java:16)
	at com.intellij.psi.impl.source.tree.SharedImplUtil.getNextSibling(SharedImplUtil.java:46)
	at com.intellij.psi.impl.source.tree.LeafPsiElement.getNextSibling(LeafPsiElement.java:75)
	at com.intellij.codeInsight.daemon.impl.Divider.divideInsideAndOutsideInOneRoot(Divider.java:154)
	at com.intellij.codeInsight.daemon.impl.Divider.divideInsideAndOutsideInOneRoot(Divider.java:73)
	at com.intellij.codeInsight.daemon.impl.Divider.divideInsideAndOutsideAllRoots(Divider.java:60)
	at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectInformationWithProgress(GeneralHighlightingPass.java:165)
	at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:84)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:56)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:400)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1096)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:393)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:688)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:634)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:64)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:392)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:368)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:167)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:178)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:366)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:188)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

The file is at https://github.com/realworldocaml/book/blob/master/book/parsing-with-ocamllex-and-menhir/examples/parsing/short_parser.mly .
e.g. just the line "%token <int> INT" is enough to cause the error.

The ReasonML version is 0.102.1-2021.1

@giraud
Copy link
Owner

giraud commented Aug 25, 2021

@JoAllg I see, thanks

@giraud
Copy link
Owner

giraud commented Aug 25, 2021

@JoAllg I'm trying to fix the bug, but mly is far from my initial goal for this plugin and I should probably have not tried to add a parser for it. The point is, don't expect anything good for mly files.

@giraud
Copy link
Owner

giraud commented Aug 26, 2021

fixed in 0.102.2

@giraud giraud closed this as completed Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants