summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/semtypes.nim4
-rw-r--r--tests/constr/a.nim2
-rw-r--r--tests/constr/b.nim2
-rw-r--r--tests/constr/t18990.nim3
4 files changed, 9 insertions, 2 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim
index 60fc8e5c8..8b1abdd01 100644
--- a/compiler/semtypes.nim
+++ b/compiler/semtypes.nim
@@ -1298,7 +1298,7 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode,
     if hasDefault:
       def = a[^1]
       block determineType:
-        if genericParams.isGenericParams:
+        if genericParams != nil and genericParams.len > 0:
           def = semGenericStmt(c, def)
           if hasUnresolvedArgs(c, def):
             def.typ = makeTypeFromExpr(c, def.copyTree)
@@ -1426,7 +1426,7 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode,
           result.flags.excl tfHasMeta
       result.n.typ = r
 
-  if genericParams.isGenericParams:
+  if genericParams != nil and genericParams.len > 0:
     for n in genericParams:
       if {sfUsed, sfAnon} * n.sym.flags == {}:
         result.flags.incl tfUnresolved
diff --git a/tests/constr/a.nim b/tests/constr/a.nim
new file mode 100644
index 000000000..03788fc57
--- /dev/null
+++ b/tests/constr/a.nim
@@ -0,0 +1,2 @@
+type A* = object
+  a: uint8
\ No newline at end of file
diff --git a/tests/constr/b.nim b/tests/constr/b.nim
new file mode 100644
index 000000000..437dd0550
--- /dev/null
+++ b/tests/constr/b.nim
@@ -0,0 +1,2 @@
+type B* = object
+proc A*(a, b: float): B = discard
\ No newline at end of file
diff --git a/tests/constr/t18990.nim b/tests/constr/t18990.nim
new file mode 100644
index 000000000..2f60f3c2c
--- /dev/null
+++ b/tests/constr/t18990.nim
@@ -0,0 +1,3 @@
+import a, b
+discard A(1f, 1f) # works
+proc x(b = A(1f, 1f)) = discard # doesn't work
\ No newline at end of file