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

Missing error when derived class does not call super in initializer #4277

Closed
Chriscbr opened this issue Sep 25, 2023 · 7 comments
Closed

Missing error when derived class does not call super in initializer #4277

Chriscbr opened this issue Sep 25, 2023 · 7 comments
Labels
🐛 bug Something isn't working 🛠️ compiler Compiler good first issue Good for newcomers

Comments

@Chriscbr
Copy link
Contributor

Chriscbr commented Sep 25, 2023

I tried this:

class Foo {
  new(name: str) {}
}

class Bar extends Foo {
  new() {}
}

This happened:

It compiles

I expected this:

A type checking error, saying that Bar's initializer needs a super call since it is a derived class

Is there a workaround?

No response

Component

Compiler

Wing Version

0.33.3

Node.js Version

18.14.1

Platform(s)

MacOS

Anything else?

No response

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
@Chriscbr Chriscbr added 🐛 bug Something isn't working 🛠️ compiler Compiler labels Sep 25, 2023
@Chriscbr Chriscbr changed the title Missing error when super is missing in initializer Missing error when derived class does not call super in initializer Sep 25, 2023
@staycoolcall911 staycoolcall911 added the good first issue Good for newcomers label Sep 26, 2023
@KrishnaSindhur
Copy link

KrishnaSindhur commented Oct 13, 2023

i can take look if its still open?

@staycoolcall911
Copy link
Contributor

Thanks @KrishnaSindhur, I assigned the issue to you. Please let us know if you have any questions or need pointers

Copy link

Hi,

This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

Copy link

Hi,

This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

Copy link

Hi,

This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

@staycoolcall911
Copy link
Contributor

This now correctly yields the desired error message (Wing V0.74.30):

Failed to compile.

error: Missing super() call as first statement of Bar's constructor
  --> wing/main.w:6:9
  |
6 |   new() {}
  |         ^^

@staycoolcall911
Copy link
Contributor

Fixed in #6351

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🛠️ compiler Compiler good first issue Good for newcomers
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants