From 762ade11778e8e7152bdcd0866633d022d81250d Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Thu, 2 Nov 2017 18:23:10 +0100 Subject: [PATCH] 'ord' does not produce a range type anymore --- compiler/condsyms.nim | 1 + compiler/semmagic.nim | 4 +++- lib/pure/times.nim | 4 ++-- lib/system/sysio.nim | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/compiler/condsyms.nim b/compiler/condsyms.nim index 02c31163ae..2050a746b4 100644 --- a/compiler/condsyms.nim +++ b/compiler/condsyms.nim @@ -109,3 +109,4 @@ proc initDefines*() = defineSymbol("nimGenericInOutFlags") when false: defineSymbol("nimHasOpt") defineSymbol("nimNoArrayToCstringConversion") + defineSymbol("nimNewRoof") diff --git a/compiler/semmagic.nim b/compiler/semmagic.nim index d721f42abd..0803b99ece 100644 --- a/compiler/semmagic.nim +++ b/compiler/semmagic.nim @@ -168,7 +168,9 @@ proc semTypeTraits(c: PContext, n: PNode): PNode = proc semOrd(c: PContext, n: PNode): PNode = result = n let parType = n.sons[1].typ - if isOrdinalType(parType) or parType.kind == tySet: + if isOrdinalType(parType): + discard + elif parType.kind == tySet: result.typ = makeRangeType(c, firstOrd(parType), lastOrd(parType), n.info) else: localError(n.info, errOrdinalTypeExpected) diff --git a/lib/pure/times.nim b/lib/pure/times.nim index 7dd4289048..c1d6c3e530 100644 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -224,7 +224,7 @@ proc `-`*(a, b: Time): int64 {. ## let a = fromSeconds(1_000_000_000) ## let b = fromSeconds(1_500_000_000) ## echo initInterval(seconds=int(b - a)) - ## # (milliseconds: 0, seconds: 20, minutes: 53, hours: 0, days: 5787, months: 0, years: 0) + ## # (milliseconds: 0, seconds: 20, minutes: 53, hours: 0, days: 5787, months: 0, years: 0) proc `<`*(a, b: Time): bool {. rtl, extern: "ntLtTime", tags: [], raises: [], noSideEffect.} = @@ -1225,7 +1225,7 @@ when not defined(JS): result.minute = t.minute result.hour = t.hour result.monthday = t.monthday - result.month = ord(t.month) + result.month = cint(t.month) result.year = cint(t.year - 1900) result.weekday = weekDays[t.weekday] result.yearday = t.yearday diff --git a/lib/system/sysio.nim b/lib/system/sysio.nim index a40fcc67d4..4348ffbb50 100644 --- a/lib/system/sysio.nim +++ b/lib/system/sysio.nim @@ -192,7 +192,7 @@ proc write(f: File, r: float32) = proc write(f: File, r: BiggestFloat) = if c_fprintf(f, "%g", r) < 0: checkErr(f) -proc write(f: File, c: char) = discard c_putc(ord(c), f) +proc write(f: File, c: char) = discard c_putc(cint(c), f) proc write(f: File, a: varargs[string, `$`]) = for x in items(a): write(f, x)