From 3979e83a5978e589dd8c6ebf20d02fdec6d3f3f1 Mon Sep 17 00:00:00 2001 From: Araq Date: Sun, 18 Mar 2018 17:56:10 +0100 Subject: [PATCH] fixes #7331 --- compiler/sigmatch.nim | 3 ++- tests/errmsgs/twrong_at_operator.nim | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/errmsgs/twrong_at_operator.nim diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index e4509ff913..2b45a24525 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -1145,7 +1145,8 @@ proc typeRelImpl(c: var TCandidate, f, aOrig: PType, else: fRange = prev let ff = f.sons[1].skipTypes({tyTypeDesc}) - let aa = a.sons[1].skipTypes({tyTypeDesc}) + # This typeDesc rule is wrong, see bug #7331 + let aa = a.sons[1] #.skipTypes({tyTypeDesc}) if f.sons[0].kind != tyGenericParam and aa.kind == tyEmpty: result = isGeneric diff --git a/tests/errmsgs/twrong_at_operator.nim b/tests/errmsgs/twrong_at_operator.nim new file mode 100644 index 0000000000..b6b3d101fd --- /dev/null +++ b/tests/errmsgs/twrong_at_operator.nim @@ -0,0 +1,15 @@ +discard """ +errormsg: "type mismatch: got " +line: 15 +nimout: ''' +twrong_at_operator.nim(15, 30) Error: type mismatch: got +but expected one of: +proc `@`[T](a: openArray[T]): seq[T] +proc `@`[IDX, T](a: array[IDX, T]): seq[T] + +expression: @[int] +''' +""" + +# bug #7331 +var seqOfStrings: seq[int] = @[int]