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

ast, parser, checker: check struct implements non interface type (fix #22200) #22218

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

yuyi98
Copy link
Member

@yuyi98 yuyi98 commented Sep 14, 2024

This PR check struct implements non interface type (fix #22200).

  • Check struct implements non interface type.
  • Add test.
struct Walker implements Abcde  {
	aaa  string
}

fn main() {}

PS D:\Test\v\tt1> v run .
tt1.v:1:26: error: `Abcde` is not an interface type
    1 | struct Walker implements Abcde  {
      |                          ~~~~~
    2 |     aaa  string
    3 | }

@felipensp
Copy link
Member

felipensp commented Sep 14, 2024

I've changed the implements_type to be a TypeNode ast node. So the _pos field will not be needed.

See PR #22189

@felipensp
Copy link
Member

@yuyi98 You can merge your check to it if you want. 👍🏻

@yuyi98
Copy link
Member Author

yuyi98 commented Sep 14, 2024

Ok, Thanks !

@yuyi98 yuyi98 force-pushed the check_implements_exist_interface branch from 8e915f2 to 44f11a7 Compare September 15, 2024 02:46
Copy link
Member

@Delta456 Delta456 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work

@spytheman spytheman merged commit b1ffa4e into vlang:master Sep 16, 2024
78 of 79 checks passed
@yuyi98 yuyi98 deleted the check_implements_exist_interface branch September 16, 2024 06:10
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

Successfully merging this pull request may close these issues.

vfmt removes selective import of interface when used only in implements clause
4 participants