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

Misleading multiport warning and NullPointerException in diagram synthesis #1833

Closed
cmnrd opened this issue Jun 9, 2023 · 2 comments · Fixed by #2057
Closed

Misleading multiport warning and NullPointerException in diagram synthesis #1833

cmnrd opened this issue Jun 9, 2023 · 2 comments · Fixed by #2057
Assignees
Labels
bug Something isn't working compiler

Comments

@cmnrd
Copy link
Collaborator

cmnrd commented Jun 9, 2023

target Cpp

public preamble {=
  inline std::size_t foo() { return 4; }
=}

reactor Src {
  output[4] out: void
}

reactor Sink {
  input[{=foo()=}] in: void
}

main reactor Minimal {
  src = new Src()
  sink = new Sink()
  src.out -> sink.in
}

The above legal C++ program produces a misleading warning message: "Left width 4 does not match right width 0". This probably comes from a false assumption made somewhere in the instance graph.

Also, the diagram synthesis fails for this program with a NullPointerException.

@cmnrd cmnrd added bug Something isn't working compiler diagrams Problems with diagram synthesis labels Jun 9, 2023
@soerendomroes
Copy link
Collaborator

Just for the record, the exception.

Java.lang.NullPointerException: Cannot read field "_interleaved" because "src" is null
	at org.lflang.generator.ReactorInstance.connectPortInstances(ReactorInstance.java:923)
	at org.lflang.generator.ReactorInstance.establishPortConnections(ReactorInstance.java:987)
	at org.lflang.generator.ReactorInstance.<init>(ReactorInstance.java:888)
	at org.lflang.generator.ReactorInstance.<init>(ReactorInstance.java:105)
	at org.lflang.diagram.synthesis.LinguaFrancaSynthesis.transform(LinguaFrancaSynthesis.java:315)
	at org.lflang.diagram.synthesis.LinguaFrancaSynthesis.transform(LinguaFrancaSynthesis.java:1)
	at de.cau.cs.kieler.klighd.syntheses.AbstractDiagramSynthesis.transform(AbstractDiagramSynthesis.java:220)
	at de.cau.cs.kieler.klighd.syntheses.ReinitializingDiagramSynthesisProxy.transform(ReinitializingDiagramSynthesisProxy.java:289)
	at de.cau.cs.kieler.klighd.ViewContext.update(ViewContext.java:454)
	at de.cau.cs.kieler.klighd.ViewContext.update(ViewContext.java:389)
	at de.cau.cs.kieler.klighd.ViewContext.update(ViewContext.java:373)
	at de.cau.cs.kieler.klighd.LightDiagramServices.updateDiagram(LightDiagramServices.java:109)
	at de.cau.cs.kieler.klighd.LightDiagramLayoutConfig.performUpdate(LightDiagramLayoutConfig.java:425)
	at de.cau.cs.kieler.klighd.ui.view.DiagramView.doUpdateDiagram(DiagramView.java:1122)
	at de.cau.cs.kieler.klighd.ui.view.DiagramView$10.runInUIThread(DiagramView.java:1007)
	at org.eclipse.ui.progress.UIJob.lambda$0(UIJob.java:148)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:5040)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4520)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
	...

The source RuntimeRange seems to be null here. In Epoch you can find the stack trace in the "Error Log" view.
In VS Code it is one logged to the notifications without browserifying the strings properly.
Both is not ideal. In Epoch, this should be logged to the console to be able to jump to the corresponding class. In VS Code it should also be logged to the output view.

@a-sr
Copy link
Collaborator

a-sr commented Oct 4, 2023

As this is an issue with the graph analysis (ReactorInstance) and probably not the diagram, I will remove the diagram label from this issue.

@a-sr a-sr removed the diagrams Problems with diagram synthesis label Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants