Skip to content

Incorrect diagnostics for complex union types #91

@HT154

Description

@HT154

Repro:

class Expr
typealias Expression = Expr|String(startsWith("${"), endsWith("}"))

class A {
	username: String|Expression
}

x: A = new {
	username = "admin"
//             ^^^^^^^
//             Constraint violation.
//             Required: startsWith("${")
//             Found: "admin"
}

This goes away if Expression is aliased to just the constrained string or if the alias is "dereferenced" and copied directly into the type annotation of A.username

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions