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:
Daniel Chao
2026-08-19 11:10:32 -07:00
committed by GitHub
co-authored by Islon Scherer
parent ac43bdbb17
commit 4dd37219c0
12 changed files with 129 additions and 16 deletions
@@ -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)
@@ -0,0 +1,3 @@
import "typeAliasConstraint2.pkl"
typealias MyTypeAlias = Any(this is typeAliasConstraint2.MyClass)
@@ -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 {}
@@ -0,0 +1,6 @@
import "../../input-helper/types/typeAliasAmendModule.pkl"
local const function isValid(s: String): Boolean = s.startsWith("Alice")
res = typeAliasAmendModule.name
@@ -0,0 +1,3 @@
res {}
res2 {}
res3 {}
@@ -0,0 +1 @@
res = "Bob Marley"