Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

[New rule] unnessecary-late-keyword #1179

Closed
1 task
DetachHead opened this issue Feb 1, 2023 · 4 comments
Closed
1 task

[New rule] unnessecary-late-keyword #1179

DetachHead opened this issue Feb 1, 2023 · 4 comments
Assignees
Labels
area-rules type: enhancement New feature or request

Comments

@DetachHead
Copy link

Rule details

report an error if a late variable is initialized on the same line, as the late keyword is not required.

What type of rule is this?

Warns about a potential problem

Example code

late bool foo = false; // error
late bool bar; // no error

Participation

  • I am willing to submit a pull request to implement this rule.

Additional comments

i raised this before #1113 but i worded it terribly. sorry!

@incendial
Copy link
Member

@DetachHead the thing with late is that it produces a lazy computed variable and the value will be calculated only on the first usage. I'm not sure that we're able to distinguish when late is used on purpose or not. Maybe you can add more examples?

@incendial
Copy link
Member

So I can understand when this functionality is part of avoid-late-keword, but as a separate rule - it will create false-positives

@DetachHead
Copy link
Author

the thing with late is that it produces a lazy computed variable and the value will be calculated only on the first usage. I'm not sure that we're able to distinguish when late is used on purpose or not. Maybe you can add more examples?

ah, I didn't know it worked like that. i'll close this issue then. sorry again for wasting your time with #1113

@DetachHead DetachHead closed this as not planned Won't fix, can't repro, duplicate, stale Feb 1, 2023
@incendial
Copy link
Member

No problem, #1113 looks fine

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-rules type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants