-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Closed
Copy link
Labels
Description
when a dotOperators is defined (with {.experimental: "dotOperators".}
), it affects unrelated undeclared field error messages.
Example 1
{.experimental: "dotOperators".}
type Foo = object
template `.`(a: Foo, b: untyped): untyped = 123
type Bar = object
x1: int
var b: Bar
echo b.x
Current Output
Error: type mismatch: got <Bar>
but expected one of:
template `.`(a: Foo; b: untyped): untyped
first type mismatch at position: 1
required type for a: Foo
but expression 'b' is of type: Bar
expression: x(b)
echo b.x
Expected Output
should contain the following errmsg which is what we get without template
.(a: Foo, b: untyped): untyped = 123
:
Error: undeclared field: 'x' for type t0892.Bar [declared in t0892.nim(11, 6)]
echo b.x
in addition to the above errmsg Error: type mismatch: got <Bar>...
Example 2
callOperator
has the same problems
Additional Information
- recent devel ba4fbb6
- this would be mitigated but not fixed by Force experimental switch to be able to use call/dot operators #16924
treeform, qaziquza, rlipsc and avahe-kellenberger