cleanup Ordinal (#13501)

This commit is contained in:
Timothee Cour 2020-02-27 01:43:13 -08:00 • committed by GitHub
commit 6a0e87eb38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 10 deletions

View file

@ -193,3 +193,20 @@ block:
a = {k1}
b = {k1,k2}
doAssert a < b
block: # Ordinal
doAssert int is Ordinal
doAssert uint is Ordinal
doAssert int64 is Ordinal
doAssert uint64 is Ordinal
doAssert char is Ordinal
type Foo = enum k1, k2
doAssert Foo is Ordinal
doAssert Foo is SomeOrdinal
doAssert enum is SomeOrdinal
# these fail:
# doAssert enum is Ordinal # fails
# doAssert Ordinal is SomeOrdinal
# doAssert SomeOrdinal is Ordinal

View file

@ -3,9 +3,9 @@ discard """
line: 17
nimout: '''type mismatch: got <int>
but expected one of:
proc inc[T: Ordinal | uint | uint64](x: var T; y = 1)
proc inc[T: Ordinal](x: var T; y = 1)
first type mismatch at position: 1
required type for x: var T: Ordinal or uint or uint64
required type for x: var T: Ordinal
but expression 'i' is immutable, not 'var'
expression: inc i