diff options
Diffstat (limited to 'tests/proc/t15949.nim')
-rw-r--r-- | tests/proc/t15949.nim | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/tests/proc/t15949.nim b/tests/proc/t15949.nim index bc3fddc84..6467ed5d3 100644 --- a/tests/proc/t15949.nim +++ b/tests/proc/t15949.nim @@ -1,14 +1,9 @@ -# bug #15949 +# bug #15949 and RFC #480 -discard """ -errormsg: "parameter 'a' requires a type" -nimout: ''' -t15949.nim(20, 14) Error: parameter 'a' requires a type''' -""" +proc procWarn(a, b = 1): (int, int) = (a, b) #[tt.Warning + ^ a, b all have default value '1', this may be unintentional, either use ';' (semicolon) or explicitly write each default value [ImplicitDefaultValue]]# - -# line 10 -proc procGood(a, b = 1): (int, int) = (a, b) +proc procGood(a = 1, b = 1): (int, int) = (a, b) doAssert procGood() == (1, 1) doAssert procGood(b = 3) == (1, 3) @@ -17,4 +12,5 @@ doAssert procGood(a = 5, b = 6) == (5, 6) # The type (and default value propagation breaks in the below example # as semicolon is used instead of comma. -proc procBad(a; b = 1): (int, int) = (a, b) +proc procBad(a; b = 1): (int, int) = (a, b) #[tt.Error + ^ parameter 'a' requires a type]# |