mirror of
https://github.com/apple/pkl.git
synced 2026-05-03 05:34:26 +02:00
Produce more helpful output when module output is overwritten (#716)
Fix a bug where overwriting `output` causes a PklBugException. This now produces a more helpful message pointing to the actual problem. Co-authored-by: translatenix <119817707+translatenix@users.noreply.github.com>
This commit is contained in:
1
pkl-core/src/test/files/LanguageSnippetTests/input/errors/invalidOutput1.pkl
vendored
Normal file
1
pkl-core/src/test/files/LanguageSnippetTests/input/errors/invalidOutput1.pkl
vendored
Normal file
@@ -0,0 +1 @@
|
||||
output: String = "abc"
|
||||
3
pkl-core/src/test/files/LanguageSnippetTests/input/errors/invalidOutput2.pkl
vendored
Normal file
3
pkl-core/src/test/files/LanguageSnippetTests/input/errors/invalidOutput2.pkl
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
class Test {}
|
||||
|
||||
output: Test = new {}
|
||||
1
pkl-core/src/test/files/LanguageSnippetTests/input/errors/invalidOutput3.pkl
vendored
Normal file
1
pkl-core/src/test/files/LanguageSnippetTests/input/errors/invalidOutput3.pkl
vendored
Normal file
@@ -0,0 +1 @@
|
||||
output = null
|
||||
6
pkl-core/src/test/files/LanguageSnippetTests/output/errors/invalidOutput1.err
vendored
Normal file
6
pkl-core/src/test/files/LanguageSnippetTests/output/errors/invalidOutput1.err
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
–– Pkl Error ––
|
||||
Expected `output` of module `file:///$snippetsDir/input/errors/invalidOutput1.pkl` to be of type `ModuleOutput`, but got type `String`.
|
||||
|
||||
x | output: String = "abc"
|
||||
^^^^^
|
||||
at output (file:///$snippetsDir/input/errors/invalidOutput1.pkl)
|
||||
6
pkl-core/src/test/files/LanguageSnippetTests/output/errors/invalidOutput2.err
vendored
Normal file
6
pkl-core/src/test/files/LanguageSnippetTests/output/errors/invalidOutput2.err
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
–– Pkl Error ––
|
||||
Expected `output` of module `file:///$snippetsDir/input/errors/invalidOutput2.pkl` to be of type `ModuleOutput`, but got type `invalidOutput2#Test`.
|
||||
|
||||
x | output: Test = new {}
|
||||
^^^^^^
|
||||
at output (file:///$snippetsDir/input/errors/invalidOutput2.pkl)
|
||||
10
pkl-core/src/test/files/LanguageSnippetTests/output/errors/invalidOutput3.err
vendored
Normal file
10
pkl-core/src/test/files/LanguageSnippetTests/output/errors/invalidOutput3.err
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
–– Pkl Error ––
|
||||
Expected value of type `ModuleOutput`, but got `null`.
|
||||
|
||||
xx | hidden output: ModuleOutput = new {
|
||||
^^^^^^^^^^^^
|
||||
at pkl.base#Module.output (pkl:base)
|
||||
|
||||
x | output = null
|
||||
^^^^
|
||||
at invalidOutput3#output (file:///$snippetsDir/input/errors/invalidOutput3.pkl)
|
||||
Reference in New Issue
Block a user