minor improvements to follow up recent PRs (#20342)

put mOpenArrayToSeq in compile-time evaluation whitelist
(it was mNone before which was whitelisted), homogenize
"ordinal type expected" errors, put overloadable enums
in non-experimental manual
This commit is contained in:
metagn 2022-09-14 19:30:15 +03:00 • committed by GitHub
commit a73ae3e066
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 45 additions and 51 deletions

View file

@ -86,44 +86,6 @@ No Unicode normalization step is performed.
pragma `{.experimental: "unicodeOperators".}` reliably.
Overloadable enum value names
=============================
Enum value names are overloadable, much like routines. If both of the enums
`T` and `U` have a member named `foo`, then the identifier `foo` corresponds
to a choice between `T.foo` and `U.foo`. During overload resolution,
the correct type of `foo` is decided from the context. If the type of `foo` is
ambiguous, a static error will be produced.
```nim test = "nim c $1"
type
E1 = enum
value1,
value2
E2 = enum
value1,
value2 = 4
const
Lookuptable = [
E1.value1: "1",
# no need to qualify value2, known to be E1.value2
value2: "2"
]
proc p(e: E1) =
# disambiguation in 'case' statements:
case e
of value1: echo "A"
of value2: echo "B"
p value2
```
Previously required `{.experimental: "overloadableEnums".}` to enable,
now always enabled.
Top-down type inference
=======================