summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-09-13 18:48:14 +0200
committerAraq <rumpf_a@web.de>2012-09-13 18:48:14 +0200
commit4a435a8fb4551b03bdcbbbd9b074a51fa46928dd (patch)
tree5d83bf8195b6706c70da921d199d9a04ebc539ee /compiler
parentd336cb4957c6b223ce7e8d717718217cb0665b56 (diff)
parent36155a6813cb414666753f6b66e04e1044954f85 (diff)
downloadNim-4a435a8fb4551b03bdcbbbd9b074a51fa46928dd.tar.gz
Merge branch 'master' of github.com:Araq/Nimrod
Diffstat (limited to 'compiler')
-rwxr-xr-xcompiler/sigmatch.nim25
1 files changed, 12 insertions, 13 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 1f4c9653e..4d407fcb6 100755
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -370,23 +370,22 @@ proc typeRel(c: var TCandidate, f, a: PType): TTypeRelation =
   of tyVar: 
     if a.kind == f.kind: result = typeRel(c, base(f), base(a))
     else: result = typeRel(c, base(f), a)
-  of tyArray, tyArrayConstr: 
+  of tyArray, tyArrayConstr:
     # tyArrayConstr cannot happen really, but
     # we wanna be safe here
     case a.kind
-    of tyArray: 
-      result = minRel(typeRel(c, f.sons[0], a.sons[0]), 
-                      typeRel(c, f.sons[1], a.sons[1]))
-      if result < isGeneric: result = isNone
-    of tyArrayConstr: 
+    of tyArray, tyArrayConstr:
+      var fRange = f.sons[0]
+      if fRange.kind == tyGenericParam:
+        var prev = PType(idTableGet(c.bindings, fRange))
+        if prev == nil:
+          put(c.bindings, fRange, a.sons[0])
+          fRange = a
+        else:
+          fRange = prev
       result = typeRel(c, f.sons[1], a.sons[1])
-      if result < isGeneric: 
-        result = isNone
-      else: 
-        if (result != isGeneric) and (lengthOrd(f) != lengthOrd(a)): 
-          result = isNone
-        elif f.sons[0].kind in GenericTypes: 
-          result = minRel(result, typeRel(c, f.sons[0], a.sons[0]))
+      if result < isGeneric: result = isNone
+      elif lengthOrd(fRange) != lengthOrd(a): result = isNone
     else: nil
   of tyOpenArray, tyVarargs:
     case a.Kind
">/~sircmpwn/getopt v0.0.0-20190214165041-9a4f886f9fc7 git.sr.ht/~sircmpwn/pty v0.0.0-20190330154901-3a43678975a9 github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 github.com/ddevault/go-libvterm v0.0.0-20190526194226-b7d861da3810 github.com/emersion/go-imap v1.0.0-beta.5 github.com/emersion/go-imap-idle v0.0.0-20190519112320-2704abd7050e github.com/emersion/go-message v0.10.3 github.com/emersion/go-sasl v0.0.0-20190517184301-63aa71ca65a3 github.com/emersion/go-smtp v0.11.0 github.com/gdamore/tcell v1.0.0 github.com/go-ini/ini v1.42.0 github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf github.com/kyoh86/xdg v0.0.0-20171127140545-8db68a8ea76a github.com/martinlindhe/base36 v0.0.0-20190418230009-7c6542dfbb41 github.com/mattn/go-isatty v0.0.3 github.com/mattn/go-runewidth v0.0.4 github.com/miolini/datacounter v0.0.0-20171104152933-fd4e42a1d5e0 github.com/mitchellh/go-homedir v1.1.0 github.com/pkg/errors v0.8.1 github.com/riywo/loginshell v0.0.0-20181227004642-c2f4167b2303 github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a // indirect github.com/stretchr/testify v1.3.0 golang.org/x/sys v0.0.0-20190516110030-61b9204099cb // indirect gopkg.in/ini.v1 v1.42.0 // indirect ) replace github.com/gdamore/tcell => git.sr.ht/~sircmpwn/tcell v0.0.0-20190602140719-d1981101c4c8