Generic method unable to implement an interface with a different interface passed as argument #20670
Labels
Bug
This tag is applied to issues which reports bugs.
Generics[T]
Bugs/feature requests, that are related to the V generics.
Status: Confirmed
This bug has been confirmed to be valid by a contributor.
Unit: Checker
Bugs/feature requests, that are related to the type checker.
Unit: Compiler
Bugs/feature requests, that are related to the V compiler in general.
Describe the bug
Unable to create a generic method that requires to implement an interface with a different passed interface
Reproduction Steps
Expected Behavior
See in the code sample below the get_all() function should return an array of IModel as does the code in the main()
Current Behavior
Throws an error: cannot implement interface
ICar
with a different interfaceIModel
Spytheman got it to generate an invalid C code :
while in main (the non generic and working version), it is:
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.4 35e91a7
Environment details (OS name and version, etc.)
V full version: V 0.4.4 ab4c1f4.35e91a7
OS: windows, Microsoft Windows 10 Pro v19045 64-bit
Processor: 8 cpus, 64bit, little endian,
getwd: C:\Users\Name
vexe: D:\Documents_Projects_VLang\v\v.exe
vexe mtime: 2024-01-13 07:59:37
vroot: OK, value: D:\Documents_Projects_VLang\v
VMODULES: OK, value: C:\Users\Name.vmodules
VTMP: OK, value: C:\Users\Name\AppData\Local\Temp\v_0
Git version: git version 2.9.0.windows.1
Git vroot status: 0.4.4-34-g35e91a7e (109 commit(s) behind V master)
.git/config present: true
CC version: Error: 'cc' is not recognized as an internal or external command,
operable program or batch file.
thirdparty/tcc status: thirdparty-windows-amd64 e90c2620
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: