mirror of
https://github.com/luau-lang/rfcs.git
synced 2025-04-04 18:41:00 +01:00
Update eager-inference-annotations-for-polymorphic-types.md
This commit is contained in:
parent
8a24f5b8fa
commit
9df20a06c4
1 changed files with 2 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
Introduce a way to opt into monomorphic (greedy) type inference for generics, preventing them from widening into unions when instantiated with different types.
|
Introduce a way to annotate a polymorphic function signature to express that it will only allow one argument type to interact with automatic instantiation.
|
||||||
|
|
||||||
## Motivation
|
## Motivation
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ test(1, "string") -- Type error: Expected `number`, got `string`
|
||||||
|
|
||||||
## Design
|
## Design
|
||||||
|
|
||||||
This RFC proposes adding some symbol next to each type variable which is a clear opt-in.
|
This RFC proposes adding some symbol as a suffix (or prefix) that annotates the inference behaviour for the generic.
|
||||||
|
|
||||||
### New Syntax
|
### New Syntax
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue