mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-07 13:33:22 +00:00
fixes #712
This commit is contained in:
@@ -120,7 +120,8 @@ proc commonType*(x, y: PType): PType =
|
||||
if a.kind == tyObject and b.kind == tyObject:
|
||||
result = commonSuperclass(a, b)
|
||||
# this will trigger an error later:
|
||||
if result.isNil: return x
|
||||
if result.isNil or result == a: return x
|
||||
if result == b: return y
|
||||
if k != tyNone:
|
||||
let r = result
|
||||
result = newType(k, r.owner)
|
||||
|
||||
20
tests/exprs/tifexpr_typeinference.nim
Normal file
20
tests/exprs/tifexpr_typeinference.nim
Normal file
@@ -0,0 +1,20 @@
|
||||
#bug #712
|
||||
|
||||
import tables
|
||||
|
||||
proc test(): TTable[string, string] =
|
||||
discard
|
||||
|
||||
proc test2(): TTable[string, string] =
|
||||
discard
|
||||
|
||||
var x = 5
|
||||
let blah =
|
||||
case x
|
||||
of 5:
|
||||
test2()
|
||||
of 2:
|
||||
test()
|
||||
else: test()
|
||||
|
||||
echo blah.len
|
||||
Reference in New Issue
Block a user