Fix instrumentation of let exprs inside type constraints (#2035)
This commit is contained in:
1 parent
8ef97b929b
commit
08cc669b49
3 files changed
+46
-7
No files matched your search
+10
-7
@@ -80,13 +80,16 @@ public final class ExecuteCustomThisWithRootNode extends ExpressionNode {
|
||||
@Override
|
||||
public Node deepCopy() {
|
||||
// The expression belongs to a separate root and is not copied as a child of this node.
|
||||
return new ExecuteCustomThisWithRootNode(
|
||||
sourceSection,
|
||||
(ExpressionNode) expressionNode.deepCopy(),
|
||||
frameDescriptor,
|
||||
qualifiedName,
|
||||
forGeneratorSlots,
|
||||
parameterSlots);
|
||||
var copy =
|
||||
new ExecuteCustomThisWithRootNode(
|
||||
sourceSection,
|
||||
(ExpressionNode) expressionNode.deepCopy(),
|
||||
frameDescriptor,
|
||||
qualifiedName,
|
||||
forGeneratorSlots,
|
||||
parameterSlots);
|
||||
copy.adoptChildren();
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import "pkl:test"
|
||||
|
||||
typealias SiteID = String(let (parts = split("-")) parts.length == 3)
|
||||
|
||||
invalid = test.catch(() -> new Listing<SiteID> { "xyz" }.toList())
|
||||
|
||||
bad = new Listing<SiteID> { "xyz" }.toList()
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
–– Pkl Error ––
|
||||
Type constraint `let (parts = split("-")) parts.length == 3` violated.
|
||||
Value: "xyz"
|
||||
|
||||
let (parts = split("-")) parts.length == 3
|
||||
│ │ │ │
|
||||
│ │ 1 false
|
||||
│ List("xyz")
|
||||
List("xyz")
|
||||
|
||||
x | typealias SiteID = String(let (parts = split("-")) parts.length == 3)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
at constraints15#bad (file:///$snippetsDir/input/classes/constraints15.pkl)
|
||||
|
||||
x | bad = new Listing<SiteID> { "xyz" }.toList()
|
||||
^^^^^
|
||||
at constraints15#bad[#1] (file:///$snippetsDir/input/classes/constraints15.pkl)
|
||||
|
||||
x | bad = new Listing<SiteID> { "xyz" }.toList()
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
at constraints15#bad (file:///$snippetsDir/input/classes/constraints15.pkl)
|
||||
|
||||
xxx | renderer.renderDocument(value)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
at pkl.base#Module.output.text (pkl:base)
|
||||
|
||||
xxx | if (renderer is BytesRenderer) renderer.renderDocument(value) else text.encodeToBytes("UTF-8")
|
||||
^^^^
|
||||
at pkl.base#Module.output.bytes (pkl:base)
|
||||
Reference in new issue
Block a user