tpointerprocs.nim 976 B

123456789101112131415161718192021222324252627282930313233343536
  1. discard """
  2. cmd: "nim check $options --hints:off $file"
  3. action: "reject"
  4. nimout:'''
  5. tpointerprocs.nim(22, 11) Error: 'foo' doesn't have a concrete type, due to unspecified generic parameters.
  6. tpointerprocs.nim(34, 14) Error: type mismatch: got <int>
  7. but expected one of:
  8. proc foo(x: int | float; y: int or string): float
  9. first type mismatch at position: 2 in generic parameters
  10. missing generic parameter: y:type
  11. expression: foo[int]
  12. tpointerprocs.nim(34, 14) Error: cannot instantiate: 'foo[int]'
  13. tpointerprocs.nim(34, 14) Error: expression 'foo[int]' has no type (or is ambiguous)
  14. tpointerprocs.nim(35, 11) Error: expression 'bar' has no type (or is ambiguous)
  15. '''
  16. """
  17. block:
  18. proc foo(x: int | float): float = result = 1.0
  19. let
  20. bar = foo
  21. baz = bar
  22. block:
  23. proc foo(x: int | float): float = result = 1.0
  24. let
  25. bar = foo[int]
  26. baz = bar
  27. block:
  28. proc foo(x: int | float, y: int or string): float = result = 1.0
  29. let
  30. bar = foo[int]
  31. baz = bar