Skip to content

Commit e21ff2f

Browse files
committed
[augmentations] Field inference uses only the original initializer.
1 parent df95744 commit e21ff2f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

working/augmentation-libraries/feature-specification.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,14 @@ More specifically:
390390
`augment super` expression which executes the original initializer
391391
expression when evaluated.
392392

393+
If the variable declaration in the original library does not have a type
394+
annotation, then the type is inferred only using the original library's
395+
initializer. (If there is no initializer in the original library, then the
396+
variable is inferred to have type `dynamic` like any non-augmented variable.
397+
*This ensures that augmenting a variable doesn't change its type. This is
398+
necessary to ensure that macros running after signatures are known can't
399+
change the signature of a declaration.*
400+
393401
**TODO: What if the augmenting variable doesn't have an initializer?**
394402

395403
It is a compile-time error if:

0 commit comments

Comments
 (0)