Skip to content

Cannot extract generic parameter from normal parameter in proc heading #8459

@awr1

Description

@awr1
type
  Foo[T] = object
    a: T
  Bar[T] = object
    b: T

proc doThing(foo: Foo): Bar[foo.T] =
  result.b = foo.a

var foo: Foo[int]
foo.a = 100
let what = doThing(foo)

output:

c:/nimtests $ nim c paramextract.nim
Hint: used config file 'c:\Nim\config\nim.cfg' [Conf]
Hint: system [Processing]
Hint: paramextract [Processing]
paramextract.nim(13, 19) template/generic instantiation from here
paramextract.nim(8, 28) Error: cannot instantiate: 'result:type'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions