finos/morphir-elm

The Scala code generated from the reference-model does not compile

Offen

#566 geöffnet am 29.11.2021

 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)Elm (69 Forks)auto 404
buggood first issuehelp wantedscala-gen

Repository-Metriken

Stars
 (51 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 3h 4m) (2 gemergte PRs in 30 T)

Beschreibung

Describe the bug The Scala compiler reports the following error on the generated code:

[error] C:/dev/ws/morphir-elm/tests-integration/generated/refModel/src/scala/morphir/reference/model/Values.scala:334:27: illegal start of simple expression
[error]     morphir.sdk.List.all((val: morphir.sdk.Basics.Int) =>
[error]                           ^
[error] C:/dev/ws/morphir-elm/tests-integration/generated/refModel/src/scala/morphir/reference/model/Values.scala:613:1: ')' expected but '}' found.
[error] }
[error] ^
[error] two errors found
1 targets failed
generated.refModel.compile Compilation failed
[13:31:01] 'testIntegrationBuildScala' errored after 14 s
[13:31:01] Error: Command failed: mill __.compile
    at makeError (C:\dev\ws\morphir-elm\node_modules\execa\index.js:174:9)
    at C:\dev\ws\morphir-elm\node_modules\execa\index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async testIntegrationBuildScala (C:\dev\ws\morphir-elm\gulpfile.js:140:9)

To Reproduce Steps to reproduce the behavior:

  1. Make sure the mill Scala build tool is installed on your system.
  2. Run npm test
  3. See error

Expected behavior The generated Scala code should compile. The specific issue here is that the model contains a variable name that clashes with the val keyword in Scala. The Scala Backend should be clever enough to change the name to avoid collisions.

Contributor Guide