- 
                Notifications
    
You must be signed in to change notification settings  - Fork 257
 
feat: support class covariant overrides in kernel, tools and docs #4925
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
Conversation
341e875    to
    fc8c4ed      
    Compare
  
    d9f8334    to
    e9d2913      
    Compare
  
    ) This adds support for the new `class-covariant-overrides` feature into `@jsii/spec`. `class-covariant-overrides` relaxes the existing restriction on covariant overrides [^1]. With the feature it is now allowed to override the `type of readonly class properties` and the `return type of class methods` when extending other classes, as long as the changes are covariant [^2] [^3] to the superclass. Importantly, covariant overrides are still not allowed when implementing interfaces. Compilers that are producing assemblies with covariant class overrides MUST include `class-covariant-overrides` in the `usedFeatures` set. This feature does not require any changes to the kernels, runtimes or packmak. All generated code already is already correct when given an appropriate assembly. We can now add support for this feature due to the upgrade to `net6.0` [^4] which was the only thing blocking it. Proof all of this is working together: #4925 [^1]: https://aws.github.io/jsii/user-guides/lib-author/typescript-restrictions/#covariant-overrides-parameter-list-changes [^2]: https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science) [^3]: As of today this feature strictly applies to class and interface types, event though some built-in types like lists might also be technically covariant. [^4]: #4916 --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR will need features passed into loadAssembly calls in various places, won't it?
See my PRs I guess
| 
           Here is what I was referring to: #4929  | 
    
          
 I'll wait for you PRs to be merged to avoid duplication. 👍🏻  | 
    
0cdf0c5    to
    37cb171      
    Compare
  
    37cb171    to
    9f36773      
    Compare
  
    | 
           @Mergifyio queue  | 
    
          
 🛑 Configuration not compatible with a branch protection settingThe branch protection setting   | 
    
| 
           Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it!  | 
    
| 
           Merging (with squash)...  | 
    
| 
           @Mergifyio refresh  | 
    
          
 ✅ Pull request refreshed | 
    
| 
           @Mergifyio queue  | 
    
          
 🛑 Configuration not compatible with a branch protection settingThe branch protection setting   | 
    
Updates docs and additional tools with support for class covariant overrides.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.