mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
Restrict usages of type variables in non-generalized contexts
Type variables can only be used on functions (and in number literals as a carve-out for now). In all other cases, a type variable takes on a single, concrete type based on later usages. This check emits errors when this is violated. The implementation is to check the rank of a variable after it could be generalized. If the variable is not generalized but annotated as a type variable, emit an error.
This commit is contained in:
parent
f5961cbb22
commit
a0461679dd
13 changed files with 230 additions and 114 deletions
|
@ -532,7 +532,7 @@ pi = 3.14159265358979323846264338327950288419716939937510
|
|||
|
||||
## Circle constant (τ)
|
||||
tau : Frac *
|
||||
tau = 2 * pi
|
||||
tau = 6.2831853071795864769252867665590057683943387987502
|
||||
|
||||
# ------- Functions
|
||||
## Convert a number to a [Str].
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue