t15949.nim 659 B

1234567891011121314151617
  1. # bug #15949 and RFC #480
  2. proc procWarn(a, b = 1): (int, int) = (a, b) #[tt.Warning
  3. ^ a, b all have default value '1', this may be unintentional, either use ';' (semicolon) or explicitly write each default value [ImplicitDefaultValue]]#
  4. proc procGood(a = 1, b = 1): (int, int) = (a, b)
  5. doAssert procGood() == (1, 1)
  6. doAssert procGood(b = 3) == (1, 3)
  7. doAssert procGood(a = 2) == (2, 1)
  8. doAssert procGood(a = 5, b = 6) == (5, 6)
  9. # The type (and default value propagation breaks in the below example
  10. # as semicolon is used instead of comma.
  11. proc procBad(a; b = 1): (int, int) = (a, b) #[tt.Error
  12. ^ parameter 'a' requires a type]#