Nim icon indicating copy to clipboard operation
Nim copied to clipboard

Parameter not matched in template following symchoice changes

Open arnetheduck opened this issue 1 year ago • 13 comments

Description

type Result[T, E] = object

func value*[T, E](self: Result[T, E]): T {.inline.} =
  discard

func value*[T: not void, E](self: var Result[T, E]): var T {.inline.} =
  discard

template unrecognizedFieldWarning =
  echo value

proc readValue*(value: var int) =
  unrecognizedFieldWarning()

Regression likely caused by #23892

Nim Version

Nim Compiler Version 2.0.9 [Linux: amd64] Compiled at 2024-08-22 Copyright (c) 2006-2023 by Andreas Rumpf

git hash: d6f7625626e4e19b9dd57147d2c8527a40fd4a03 active boot switches: -d:release

(version-2-0 branch)

Current Output

testit.nim(13, 27) Error: type mismatch
Expression: echo value
  [1] value: proc (self: Result[value.T, value.E]): T{.inline, noSideEffect.} | proc (self: var Result[value.T, value.E]): var T: not void{.inline, noSideEffect.}

Expected one of (first mismatch at [position]):
[1] proc echo(x: varargs[typed, `$`])

Expected Output

No response

Possible Solution

No response

Additional Information

No response

arnetheduck avatar Aug 22 '24 10:08 arnetheduck