diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-11-18 22:13:46 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-11-18 22:13:46 +0100 |
commit | a9ac24169167246dea63605a8556ae9b6629c66e (patch) | |
tree | 4762085660bbf1a3590c2f6d19c92d0e83f72a62 | |
parent | 3fdb78fe80cf29f54ef222f035aece6f6190cdc4 (diff) | |
download | Nim-a9ac24169167246dea63605a8556ae9b6629c66e.tar.gz |
fixes #6073
-rw-r--r-- | compiler/sigmatch.nim | 2 | ||||
-rw-r--r-- | tests/types/tyet_another_generic_regression.nim | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 31714b7bf..3d0b0ed3d 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -1385,7 +1385,7 @@ proc typeRelImpl(c: var TCandidate, f, aOrig: PType, # XXX: This is very hacky. It should be moved back into liftTypeParam if x.kind in {tyGenericInst, tyArray} and c.calleeSym != nil and - c.calleeSym.kind in {skProc, skFunc}: + c.calleeSym.kind in {skProc, skFunc} and c.call != nil: let inst = prepareMetatypeForSigmatch(c.c, c.bindings, c.call.info, f) return typeRel(c, inst, a) diff --git a/tests/types/tyet_another_generic_regression.nim b/tests/types/tyet_another_generic_regression.nim new file mode 100644 index 000000000..914166e06 --- /dev/null +++ b/tests/types/tyet_another_generic_regression.nim @@ -0,0 +1,13 @@ +import system + +type Bar[T] = ref object + value: T + +type types = int32|int64 # if I change this to just int32 or int64 it works (compiles) + +# if I replace Bar everywhere with seq it also compiles fine +proc Foo[T: Bar[types]](): T = + when T is Bar: nil + +discard Foo[Bar[int32]]() +#bug #6073 |