-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compiler): can't instantiate preflight classes in static methods (#…
…6040) Fixed #6019 The fix adds an implicit `$scope` parameter to static methods so when they need to instantiate a preflight class they know from within which context they're being called. Note the following exceptions to adding the implicit scope param to a static preflight method: 1) JSII imported methods. In the future we might want to support this via #6067. 2) `extern` methods, since the user implements these in JS/TS and doesn't expect an implicit scope parameter. 3) Static methods that override a method of the same name in a parent class that doesn't have an implicit scope argument (because one of the above reasons). We don't have clear definitions of static method overriding, but currently we do use this for overrding `onLiftType` inherited from the imported base `std.Resource` class. Opting out of implicit scoping for this case seemed like the easiest solution. ## Checklist - [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted) - [x] Description explains motivation and solution - [x] Tests added (always) - [ ] Docs updated (only required for features) - [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
- Loading branch information
1 parent
f74c6d7
commit b955422
Showing
15 changed files
with
366 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.