Method called twice when mixed with "as"operator #19453
Labels
Bug
This tag is applied to issues which reports bugs.
Unit: Type System
Bugs/feature requests, that are related to the V types system.
Describe the bug
Pretty similar bevavior than this issue: #19435
This time it happens when casting return values using the keyword
as
.When we have a struct which has a field of a sum type, and a method that returns this field, when calling the method and using
as
to cast it to a specific type, the method gets called twiceReproduction Steps
Expected Behavior
The method should only be called once.
The output should be
Current Behavior
The method is called twice.
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.1 3d2731f
Environment details (OS name and version, etc.)
V full version: V 0.4.1 https://github.com/vlang/v/commit/28234c76c66034124a8d8b476d452e70b98667b8.3d2731f
OS: macos, macOS, 13.5.2
Processor: 10 cpus, 64bit, little endian, Apple M1 Max
CC version: Apple clang version 15.0.0 (clang-1500.0.40.1)
thirdparty/tcc status: thirdparty-macos-arm64 a668e5a0
Note
You can vote for this issue using the 👍 reaction. More votes increase the issue's priority
for developers.
Take into account that only the 👍 reaction counts as a vote.
Only reactions to the issue itself will be counted as votes, not comments.
The text was updated successfully, but these errors were encountered: