summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2021-12-04 07:42:58 +0100
committerGitHub <noreply@github.com>2021-12-04 07:42:58 +0100
commitd584dd5b99f4c1e32477db2dfb791d52b0139df1 (patch)
tree54363ac661b46e59385dd3a0cb453bd967ddfba7 /compiler
parent23c117a950a3ce0e3c85d4f89409075329648230 (diff)
downloadNim-d584dd5b99f4c1e32477db2dfb791d52b0139df1.tar.gz
fixes #19015 [backport:1.6] (#19204)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/options.nim3
-rw-r--r--compiler/sigmatch.nim3
2 files changed, 4 insertions, 2 deletions
diff --git a/compiler/options.nim b/compiler/options.nim
index d8e5057f9..383b6fa2a 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -207,7 +207,8 @@ type
     strictNotNil,
     overloadableEnums,
     strictEffects,
-    unicodeOperators
+    unicodeOperators,
+    flexibleOptionalParams
 
   LegacyFeature* = enum
     allowSemcheckedAstModification,
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 6bc6eefe0..93be92676 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -2461,7 +2461,8 @@ proc matchesAux(c: PContext, n, nOrig: PNode, m: var TCandidate, marker: var Int
         if m.callee.n[f].kind != nkSym:
           internalError(c.config, n[a].info, "matches")
           noMatch()
-        if a >= firstArgBlock: f = max(f, m.callee.n.len - (n.len - a))
+        if flexibleOptionalParams in c.features and a >= firstArgBlock:
+          f = max(f, m.callee.n.len - (n.len - a))
         formal = m.callee.n[f].sym
         m.firstMismatch.kind = kTypeMismatch
         if containsOrIncl(marker, formal.position) and container.isNil: