summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-03-01 23:07:22 +0100
committerAndreas Rumpf <rumpf_a@web.de>2016-03-01 23:07:22 +0100
commit312281c7cc19bf467207af93a13e9acdd9b34c60 (patch)
tree6e92ced9dddbcf998dbb296abf497fc81f9d2c7f
parent9687ea3c3e46160e44195a91922de2089cb50874 (diff)
downloadNim-312281c7cc19bf467207af93a13e9acdd9b34c60.tar.gz
fixes #3686
-rw-r--r--compiler/sigmatch.nim7
-rw-r--r--tests/concepts/tmonoid.nim13
2 files changed, 15 insertions, 5 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index ceadc2fea..e67942cb2 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -1301,11 +1301,8 @@ proc paramTypesMatchAux(m: var TCandidate, f, argType: PType,
         arg.typ.n = evaluated
         argType = arg.typ
 
-  var
-    a = if c.inTypeClass > 0: argType.skipTypes({tyTypeDesc, tyFieldAccessor})
-        else: argType
-
-    r = typeRel(m, f, a)
+  var a = argType
+  var r = typeRel(m, f, a)
 
   if r != isNone and m.calleeSym != nil and
      m.calleeSym.kind in {skMacro, skTemplate}:
diff --git a/tests/concepts/tmonoid.nim b/tests/concepts/tmonoid.nim
new file mode 100644
index 000000000..49b3239bd
--- /dev/null
+++ b/tests/concepts/tmonoid.nim
@@ -0,0 +1,13 @@
+discard """
+  output: '''true'''
+"""
+
+# bug #3686
+
+type Monoid = concept x, y
+  x + y is type(x)
+  type(z(type(x))) is type(x)
+
+proc z(x: typedesc[int]): int = 0
+
+echo(int is Monoid)