mirror of
https://github.com/apple/pkl.git
synced 2026-09-13 21:31:52 +02:00
Improve error message for aliased references (#1695)
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
import "pkl:ref"
|
||||
|
||||
typealias Ref<T> = ref.Reference<ref.Domain, T>
|
||||
|
||||
typealias Ref2<T> = Ref<T>
|
||||
|
||||
foo: Ref2<String(isEmpty)>
|
||||
@@ -0,0 +1,6 @@
|
||||
import "pkl:ref"
|
||||
|
||||
typealias Ref<T> = ref.Reference<ref.Domain, T>
|
||||
typealias Ref2<T> = Ref<T(isEmpty)>
|
||||
|
||||
foo: Ref2<String>
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
import "pkl:ref"
|
||||
|
||||
typealias Foo1 = Foo2
|
||||
typealias Foo2 = String(isEmpty)
|
||||
|
||||
foo: ref.Reference<ref.Domain, Foo1>
|
||||
@@ -1,6 +1,10 @@
|
||||
–– Pkl Error ––
|
||||
`Reference` referent type argument may not include type constraints.
|
||||
|
||||
x | typealias Ref<T> = ref.Reference<D, T>
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
at reference10#Ref (file:///$snippetsDir/input/errors/reference10.pkl)
|
||||
|
||||
x | test = ref.Reference(d, String, "") as Ref<Listing<String(true)>>
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
at reference10#test (file:///$snippetsDir/input/errors/reference10.pkl)
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
–– Pkl Error ––
|
||||
`Reference` referent type argument may not include type constraints.
|
||||
|
||||
xx | typealias Alias2 = String(length < 5)
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
at reference11#Alias2 (file:///$snippetsDir/input/errors/reference11.pkl)
|
||||
|
||||
xx | typealias Alias1 = Int | Alias2?
|
||||
^^^^^^
|
||||
at reference11#Alias1 (file:///$snippetsDir/input/errors/reference11.pkl)
|
||||
|
||||
x | typealias Ref<T> = ref.Reference<D, T>
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
at reference11#Ref (file:///$snippetsDir/input/errors/reference11.pkl)
|
||||
|
||||
x | test = ref.Reference(d, String, "") as Ref<Alias1?>
|
||||
^^^^^^^^^^^^
|
||||
at reference11#test (file:///$snippetsDir/input/errors/reference11.pkl)
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
–– Pkl Error ––
|
||||
`Reference` referent type argument may not include type constraints.
|
||||
|
||||
xx | typealias Alias2 = String(length < 5)
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
at reference12#Alias2 (file:///$snippetsDir/input/errors/reference12.pkl)
|
||||
|
||||
x | typealias RefAlias1 = ref.Reference<D, Alias1?>
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
at reference12#RefAlias1 (file:///$snippetsDir/input/errors/reference12.pkl)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
–– Pkl Error ––
|
||||
`Reference` referent type argument may not include type constraints.
|
||||
|
||||
x | typealias Ref<T> = ref.Reference<ref.Domain, T>
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
at reference21#Ref (file:///$snippetsDir/input/errors/reference21.pkl)
|
||||
|
||||
x | typealias Ref2<T> = Ref<T>
|
||||
^^^^^^
|
||||
at reference21#Ref2 (file:///$snippetsDir/input/errors/reference21.pkl)
|
||||
|
||||
x | foo: Ref2<String(isEmpty)>
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
at reference21 (file:///$snippetsDir/input/errors/reference21.pkl)
|
||||
@@ -0,0 +1,14 @@
|
||||
–– Pkl Error ––
|
||||
`Reference` referent type argument may not include type constraints.
|
||||
|
||||
x | typealias Ref<T> = ref.Reference<ref.Domain, T>
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
at reference22#Ref (file:///$snippetsDir/input/errors/reference22.pkl)
|
||||
|
||||
x | typealias Ref2<T> = Ref<T(isEmpty)>
|
||||
^^^^^^^^^^^^^^^
|
||||
at reference22#Ref2 (file:///$snippetsDir/input/errors/reference22.pkl)
|
||||
|
||||
x | foo: Ref2<String>
|
||||
^^^^
|
||||
at reference22 (file:///$snippetsDir/input/errors/reference22.pkl)
|
||||
@@ -0,0 +1,10 @@
|
||||
–– Pkl Error ––
|
||||
`Reference` referent type argument may not include type constraints.
|
||||
|
||||
x | typealias Foo2 = String(isEmpty)
|
||||
^^^^^^^^^^^^^^^
|
||||
at reference23#Foo2 (file:///$snippetsDir/input/errors/reference23.pkl)
|
||||
|
||||
x | foo: ref.Reference<ref.Domain, Foo1>
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
at reference23 (file:///$snippetsDir/input/errors/reference23.pkl)
|
||||
@@ -1,6 +1,10 @@
|
||||
–– Pkl Error ––
|
||||
`Reference` referent type argument may not include type constraints.
|
||||
|
||||
x | typealias Ref<T> = ref.Reference<D, T>
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
at reference8#Ref (file:///$snippetsDir/input/errors/reference8.pkl)
|
||||
|
||||
x | test = ref.Reference(d, String, "") as Ref<String(true)>
|
||||
^^^^^^^^^^^^^^^^^
|
||||
at reference8#test (file:///$snippetsDir/input/errors/reference8.pkl)
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
–– Pkl Error ––
|
||||
`Reference` referent type argument may not include type constraints.
|
||||
|
||||
x | typealias Ref<T> = ref.Reference<D, T>
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
at reference9#Ref (file:///$snippetsDir/input/errors/reference9.pkl)
|
||||
|
||||
x | test = ref.Reference(d, String, "") as Ref<String(true) | Int>
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
at reference9#test (file:///$snippetsDir/input/errors/reference9.pkl)
|
||||
|
||||
Reference in New Issue
Block a user