Skip to content
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

compilation success when call not existed method on struct #20120

Closed
dmitryuck opened this issue Dec 8, 2023 · 1 comment
Closed

compilation success when call not existed method on struct #20120

dmitryuck opened this issue Dec 8, 2023 · 1 comment

Comments

@dmitryuck
Copy link
Contributor

dmitryuck commented Dec 8, 2023

Describe the bug

I have a simple code:

module controller

import vweb
import entity
import usecase { ILanguageUsecase }

pub struct LanguageController {
	vweb.Context
	language_usecase ILanguageUsecase @[vweb_global]
}

@['/'; get]
pub fn (mut m LanguageController) user_index() vweb.Result {
	return m.html('Hello')
}

@['/insert-languages'; get]
pub fn (mut m LanguageController) insert_languages() vweb.Result {
	m.insert_languages()

	return m.html('Insert')
}

and it compiles success, but in runtime I got an an error:

Unhandled Exception 0xC00000FD

as you see I call a method which not exists on LanguageController struct:

m.insert_languages()

but this method exists in ILanguageUsecase interface, so the next code works as expected

m.language_usecase.insert_languages()

Reproduction Steps

copy provided code and compile

Expected Behavior

should not be compiled, and throw an error, because method not exists in structure

Current Behavior

compiles success, throw runtime errorthrows

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.3 772f114

Environment details (OS name and version, etc.)

V full version: V 0.4.3 3d0fcfe.772f114
OS: windows, Microsoft Windows 11 Home v22000 64-bit
Processor: 6 cpus, 64bit, little endian,

getwd: D:\Projects\MegaStor\megastor-server
vexe: D:\Programs\v\v.exe
vexe mtime: 2023-12-08 08:46:04

vroot: OK, value: D:\Programs\v
VMODULES: OK, value: C:\Users\monkg.vmodules
VTMP: OK, value: C:\Users\monkg\AppData\Local\Temp\v_0

Git version: git version 2.37.0.windows.1
Git vroot status: weekly.2023.48-62-g772f1149 (8 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: N/A

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.

@dmitryuck dmitryuck added the Bug This tag is applied to issues which reports bugs. label Dec 8, 2023
@shove70
Copy link
Contributor

shove70 commented Dec 10, 2023

@['/insert-languages'; get]
pub fn (mut m LanguageController) insert_languages() vweb.Result {
                                        ↑
	m.insert_languages()  -------->return m.html('Insert')
}

insert_languages()
calls are recursively made endlessly until the stack is exhausted...

@shove70 shove70 removed the Bug This tag is applied to issues which reports bugs. label Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants