mirror of
https://github.com/apple/pkl.git
synced 2026-09-13 13:21:47 +02:00
Fix name resolution of types in constraints (#1826)
This fixes an issue where type names are resolved incorrectly in typealias constraints. Co-authored-by: Islon Scherer <islonscherer@gmail.com>
This commit is contained in:
co-authored by
Islon Scherer
parent
ac43bdbb17
commit
4dd37219c0
+5
@@ -1,3 +1,8 @@
|
||||
class MyClass
|
||||
|
||||
typealias MyTypeAlias = MyClass(getClass() == MyClass)
|
||||
|
||||
typealias MyTypeAlias2 = MyClass(this is MyClass)
|
||||
|
||||
// a let expression turns the constraint node into its own root node
|
||||
typealias MyTypeAlias3 = MyClass(let (_ = true) this is MyClass)
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import "typeAliasConstraint2.pkl"
|
||||
|
||||
typealias MyTypeAlias = Any(this is typeAliasConstraint2.MyClass)
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import "../../input-helper/types/typeAliasConstraint2.pkl"
|
||||
import "../../input-helper/types/typeAliasConstraint3.pkl"
|
||||
|
||||
res: typeAliasConstraint2.MyTypeAlias2 = new typeAliasConstraint2.MyClass {}
|
||||
|
||||
res2: typeAliasConstraint3.MyTypeAlias = new typeAliasConstraint2.MyClass {}
|
||||
|
||||
res3: typeAliasConstraint2.MyTypeAlias3 = new typeAliasConstraint2.MyClass {}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
import "../../input-helper/types/typeAliasAmendModule.pkl"
|
||||
|
||||
local const function isValid(s: String): Boolean = s.startsWith("Alice")
|
||||
|
||||
res = typeAliasAmendModule.name
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
res {}
|
||||
res2 {}
|
||||
res3 {}
|
||||
+1
@@ -0,0 +1 @@
|
||||
res = "Bob Marley"
|
||||
Reference in New Issue
Block a user