temperlang / temper

3 stars 0 forks source link

Java repl translate crash in tutorial #70

Closed tjpalmer closed 9 months ago

tjpalmer commented 10 months ago

Reported by a user.

Follow the steps in the tutorial for backend translation in the repl, and all the backends mostly work, except java crashes the repl with this stack trace:

$ translate(2, "java")
1: erimeter(rectangle: Rectangle): Float64 {
                       ┗━━━━━━━┛
[interactive#2:1+32-41]: interactive#0 does not export symbol Rectangle__0
Exception in thread "main" java.lang.IllegalStateException: Type definition `Rectangle__0` not registered
        at lang.temper.be.java.JavaNames.classTypeName(JavaNames.kt:692)
        at lang.temper.be.java.JavaNames.classTypeName(JavaNames.kt:355)
        at lang.temper.be.java.JavaType$Companion.fromStatic(JavaTypes.kt:265)
        at lang.temper.be.java.JavaTranslator$ModuleScope.value(JavaTranslator.kt:1441)
        at lang.temper.be.java.JavaTranslator$ModuleScope.expr(JavaTranslator.kt:1101)
        at lang.temper.be.java.JavaTranslator$ModuleScope.modLevelDeclare(JavaTranslator.kt:567)
        at lang.temper.be.java.JavaTranslator$ModuleScope.module(JavaTranslator.kt:151)
        at lang.temper.be.java.JavaTranslator.translate(JavaTranslator.kt:90)
        at lang.temper.be.java.JavaBackend.translate(JavaBackend.kt:138)
        at lang.temper.be.syncstaging.ApplyBackendsSynchronouslyKt.applyBackendsSynchronously(ApplyBackendsSynchronously.kt:35)
        at lang.temper.cli.repl.ReplTranslateFn.invoke(ReplTranslateFn.kt:121)
        at lang.temper.interp.Interpreter.dispatchCall(Interpreter.kt:629)
        at lang.temper.interp.Interpreter.interpretCall(Interpreter.kt:788)
        at lang.temper.interp.Interpreter.interpretTreeNotSpammy(Interpreter.kt:242)
        at lang.temper.interp.Interpreter.interpretTree(Interpreter.kt:224)
        at lang.temper.interp.Interpreter.interpretTree$default(Interpreter.kt:209)
        at lang.temper.interp.Interpreter.interpretEdge$interp(Interpreter.kt:176)
        at lang.temper.interp.Interpreter.interpretFlowElement(Interpreter.kt:503)
        at lang.temper.interp.Interpreter.interpretBlock(Interpreter.kt:436)
        at lang.temper.interp.Interpreter.interpretBlock$default(Interpreter.kt:306)
        at lang.temper.interp.Interpreter.interpretTreeNotSpammy(Interpreter.kt:241)
        at lang.temper.interp.Interpreter.interpretTree(Interpreter.kt:224)
        at lang.temper.interp.Interpreter.interpretReuseEnvironment(Interpreter.kt:164)
        at lang.temper.frontend.runtime.RuntimeEmulationStage.process(RuntimeEmulationStage.kt:49)
        at lang.temper.frontend.Module$advance$1.invoke(Module.kt:541)
        at lang.temper.frontend.Module$advance$1.invoke(Module.kt:400)
        at lang.temper.frontend.TopLevelBindings.whileSynchronized(TopLevelBindings.kt:93)
        at lang.temper.frontend.Module.advance(Module.kt:400)
        at lang.temper.cli.repl.Repl.processLine(Repl.kt:312)
        at lang.temper.cli.repl.Repl.processLineRobustly(Repl.kt:206)
        at lang.temper.cli.Main$run$makeArgParser$subcommands$5.executeTemperRepl(Cli.kt:408)
        at lang.temper.cli.Main$run$makeArgParser$subcommands$5.execute(Cli.kt:365)
        at kotlinx.cli.ArgParser.parse(ArgParser.kt:657)
        at kotlinx.cli.ArgParser.parse(ArgParser.kt:530)
        at lang.temper.cli.Main.run(Cli.kt:652)
        at lang.temper.cli.Cli.main(Cli.kt:751)
tjpalmer commented 10 months ago

@ben-509 Do you want this one?