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

Error message is not correct processed #29

Open
ManuW opened this issue Oct 20, 2024 · 0 comments
Open

Error message is not correct processed #29

ManuW opened this issue Oct 20, 2024 · 0 comments

Comments

@ManuW
Copy link

ManuW commented Oct 20, 2024

I played around with Pkl. Now I tried to generate swift code from it, but it failed. I got following error message

$ ./pkl-gen-swift-macos.bin --version
0.3.0
                                                                         
$ ./pkl-gen-swift-macos.bin -o test tuclib/Timer1.pkl
Error: PklError(message: "–– Pkl Error ––\nCannot generate type Version as Swift.\n\n70 | else throw(\"Cannot generate type \\(type.referent.name) as Swift.\")\n          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nat pkl.swift.internal.typegen#generateDeclaredType.<function#3> (https://github.com/apple/pkl-swift/blob/0.3.0/codegen/src/internal/typegen.pkl#L70-L70)\n\n64 | let (mapped = seenMappings.findOrNull((it) -> it.source == referent))\n     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nat pkl.swift.internal.typegen#generateDeclaredType.<function#2> (https://github.com/apple/pkl-swift/blob/0.3.0/codegen/src/internal/typegen.pkl#L64-L70)\n\n63 | let (reflectee = type.referent.reflectee)\n     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nat pkl.swift.internal.typegen#generateDeclaredType.<function#1> (https://github.com/apple/pkl-swift/blob/0.3.0/codegen/src/internal/typegen.pkl#L63-L70)\n\n62 | let (referent = type.referent)\n     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nat pkl.swift.internal.typegen#generateDeclaredType (https://github.com/apple/pkl-swift/blob/0.3.0/codegen/src/internal/typegen.pkl#L62-L70)\n\n30 | generateDeclaredType(type, enclosing, seenMappings)\n     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nat pkl.swift.internal.typegen#generateType (https://github.com/apple/pkl-swift/blob/0.3.0/codegen/src/internal/typegen.pkl#L30-L30)\n\n121 | type = typegen.generateType(prop.type, clazz, mappings)\n             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nat pkl.swift.internal.ClassGen#getProperties.<function#7>.type (https://github.com/apple/pkl-swift/blob/0.3.0/codegen/src/internal/ClassGen.pkl#L121-L121)\n\n369 | isPolymorphic: Boolean = type.isPolymorphic\n                               ^^^^\nat pkl.swift.internal.ClassGen#Property.isPolymorphic (https://github.com/apple/pkl-swift/blob/0.3.0/codegen/src/internal/ClassGen.pkl#L369-L369)\n\n162 | when (properties.values.any((p) -> p.isPolymorphic)) {\n                                         ^^^^^^^^^^^^^^^\nat pkl.swift.internal.ClassGen#struct.<function#2> (https://github.com/apple/pkl-swift/blob/0.3.0/codegen/src/internal/ClassGen.pkl#L162-L162)\n\n162 | when (properties.values.any((p) -> p.isPolymorphic)) {\n            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nat pkl.swift.internal.ClassGen#struct (https://github.com/apple/pkl-swift/blob/0.3.0/codegen/src/internal/ClassGen.pkl#L162-L162)\n\n43 | struct\n     ^^^^^^\nat pkl.swift.internal.ClassGen#contents[#3] (https://github.com/apple/pkl-swift/blob/0.3.0/codegen/src/internal/ClassGen.pkl#L43-L43)\n\n35 | contents = new Listing {\n                ^^^^^^^^^^^^^\nat pkl.swift.internal.ClassGen#contents (https://github.com/apple/pkl-swift/blob/0.3.0/codegen/src/internal/ClassGen.pkl#L35-L45)\n\n151 | text = contents\n             ^^^^^^^^\nat pkl.swift.internal.SwiftNamespace#output.files[#1].text (https://github.com/apple/pkl-swift/blob/0.3.0/codegen/src/internal/SwiftNamespace.pkl#L151-L151)\n\n1 | output.files.toMap().mapValues((_, it) -> it.text)\n                                              ^^^^^^^\nat repl:text.<function#1> (repl:text)\n\n1 | output.files.toMap().mapValues((_, it) -> it.text)\n    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nat  (repl:text)\n")

Looks like something went wrong when printing the error: It's just one line and it's looks like the error code print commandos are logged and not the error message itself.

Way to reproduce: Create a test.pkl file with following content

import "pkl:semver"

version: semver.Version

and then run ./pkl-gen-swift-macos.bin -o test test.pkl

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

1 participant