mirror of
https://github.com/apple/pkl.git
synced 2026-05-28 01:29:15 +02:00
Execute typechecks eagerly when within a constraint (#964)
This changes the language to check all types eagerly when within a type constraint. This addresses two regressions in the language: 1. Type constraints are too relaxed (listing/mapping parameters may not be checked) 2. Failing type constraints hide members that were forced during execution of the constraint
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
typealias EmailAddress = String(matches(Regex(#".+@\S+|.+<\S+@\S+>"#)))
|
||||
|
||||
class MyClass {
|
||||
emails: Listing<EmailAddress>
|
||||
}
|
||||
|
||||
myClass: MyClass
|
||||
|
||||
others: Listing<module(this != module)>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
amends ".../input-helper/classes/MyClass.pkl"
|
||||
|
||||
myClass {
|
||||
emails {
|
||||
"baz@bar.com"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user