-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UFCS type conversion conflicts with dot operator #17056
Comments
I just wanted to expand on the above that the dot operator doesn't conflict with procs. I was hoping the behavior would be the same with types: {.experimental:"dotOperators".}
type Test = object
proc Test2(a: float) =
echo "UFCS Test2"
template `.`(obj: int, field: untyped) =
static: echo "ACCESS " & astToStr(field)
var a: int
var b: float
a.stuff # works
a.Test2 # works: calls dot operator and not the proc `Test2`
b.Test2 # works: calls the proc `Test2` and not the dot operator
a.Test # type mismatch: got <int> but expected 'Test = object' |
I think whether or not this should be changed, the behavior should be consistent with |
It would be great if the behavior was the same as with |
Thanks for the valuable feedback as I was about to deprecate dot operators, cough. Will reconsider my opinion. |
I get an error when using the dot operator with an identifier that is the same as a type's name in the current scope. I'm not sure if this is intended behavior or a bug. I know the "dotOperators" feature is still experimental, but just wanted to report this in case there were any plans of making it not experimental.
Example
Current Output
Expected Output
Possible Solution
Unknown
Additional Information
None
The text was updated successfully, but these errors were encountered: