Skip to content

type doesn't work with generics (and default) in a function definition #11112

@dawkot

Description

@dawkot
proc foo[A, B]: type(A.default + B.default) =
  discard

system.+: proc (x: float32, y: float32): float32{.noSideEffect.}
ambiguous call; both system.+(x: float32, y: float32) [declared in C:\Users\dawkot.choosenim\toolchains\nim-#devel\lib\system.nim(1507, 6)] and system.+(x: int32, y: int32) [declared in C:\Users\dawkot.choosenim\toolchains\nim-#devel\lib\system.nim(1209, 6)] match for: (type(A.default), type(B.default))

Of course, something similiar works without generics:

proc foo[A, B]: type(int8.default + int16.default) =
  discard

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions