Fix type argument lost in constraint expressions within generic typealiases (#1709)

Co-authored-by: Daniel Chao <daniel.h.chao@gmail.com>
This commit is contained in:
adityabagchi24
2026-07-01 10:10:03 -07:00
committed by GitHub
co-authored by Daniel Chao
parent bfa6a989be
commit 1c1a39e37f
5 changed files with 62 additions and 1 deletions
@@ -0,0 +1,3 @@
typealias MyList<T> = List(this[0] is T)
foo: MyList<Int> = List("uh oh")
@@ -0,0 +1,25 @@
–– Pkl Error ––
Type constraint `this[0] is T` violated.
Value: List("uh oh")
this[0] is T
│ │ │
│ │ false
│ "uh oh"
List("uh oh")
x | typealias MyList<T> = List(this[0] is T)
^^^^^^^^^^^^
at typeAliasConstraint3#foo (file:///$snippetsDir/input/types/typeAliasConstraint3.pkl)
x | foo: MyList<Int> = List("uh oh")
^^^^^^^^^^^^^
at typeAliasConstraint3#foo (file:///$snippetsDir/input/types/typeAliasConstraint3.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)