Skip to content

Commit

Permalink
typenav: fixes types of literals (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout authored Jan 7, 2025
1 parent cdd94bb commit 4ad773b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/nimony/typenav.nim
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ proc getTypeImpl(c: var TypeCache; n: Cursor): Cursor =
result = c.builtins.autoType # to indicate error
case exprKind(n)
of NoExpr:
if n.kind == Symbol:
case n.kind
of Symbol:
let res = tryLoadSym(n.symId)
if res.status == LacksNothing:
let local = asLocal(res.decl)
Expand All @@ -40,6 +41,18 @@ proc getTypeImpl(c: var TypeCache; n: Cursor): Cursor =
result = res.decl
else:
quit "gear3:could not find symbol: " & pool.syms[n.symId]
of IntLit:
result = c.builtins.intType
of UintLit:
result = c.builtins.uintType
of CharLit:
result = c.builtins.charType
of FloatLit:
result = c.builtins.floatType
of StringLit:
result = c.builtins.stringType
else:
discard
of AtX, PatX, ArrAtX:
result = getTypeImpl(c, n.firstSon)
case typeKind(result)
Expand Down

0 comments on commit 4ad773b

Please sign in to comment.