Skip to content

Commit

Permalink
some progress for #1082
Browse files Browse the repository at this point in the history
  • Loading branch information
Araq committed Apr 20, 2014
1 parent 2c97242 commit 042ffed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 9 additions & 4 deletions compiler/semtypes.nim
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,15 @@ proc semRange(c: PContext, n: PNode, prev: PType): PType =
if isRange(n[1]):
result = semRangeAux(c, n[1], prev)
let n = result.n
if n.sons[0].kind in {nkCharLit..nkUInt64Lit}:
if n.sons[0].intVal > 0 or n.sons[1].intVal < 0:
incl(result.flags, tfNeedsInit)
elif n.sons[0].floatVal > 0.0 or n.sons[1].floatVal < 0.0:
if n.sons[0].kind in {nkCharLit..nkUInt64Lit} and n.sons[0].intVal > 0:
incl(result.flags, tfNeedsInit)
elif n.sons[1].kind in {nkCharLit..nkUInt64Lit} and n.sons[1].intVal < 0:
incl(result.flags, tfNeedsInit)
elif n.sons[0].kind in {nkFloatLit..nkFloat64Lit} and
n.sons[0].floatVal > 0.0:
incl(result.flags, tfNeedsInit)
elif n.sons[1].kind in {nkFloatLit..nkFloat64Lit} and
n.sons[1].floatVal < 0.0:
incl(result.flags, tfNeedsInit)
else:
localError(n.sons[0].info, errRangeExpected)
Expand Down
3 changes: 2 additions & 1 deletion tests/ccgbugs/tcgbug.nim
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ new(a)
q(a)

# bug #914
var x = newWideCString("Hello")
when defined(windows):
var x = newWideCString("Hello")

echo "success"

Expand Down

0 comments on commit 042ffed

Please sign in to comment.