-
Notifications
You must be signed in to change notification settings - Fork 23
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
Error when @override method takes a type union as a parameter #35
Comments
…overrides of same methods by HTMLDocument The open(...), close(), write(...) and writeln(...) methods on Document are now part of the standard and have been moved to w3c_dom1.js to reflect this. The typing of Document.prototype.open and Document.prototype.close was previously incomplete. These have been aligned with the specification and with the methods in HTMLDocument that overrode these methods. This may impact type checking but that would be very surprising. The overrides in HTMLDocument have been removed. This is done due to limitations of the jsinterop-generator tool that is more fully described in google/jsinterop-generator#35 While the specifications explicitly indicate that these overrides are present and annotates (requiring the [OverrideBuiltins] attribute be applied to the containing interface in WebIDL) it is not expected that this has any practical impact on programs type checking against the externs.
I should note that this is not a blocker (assuming google/closure-compiler#3399 is merged) as the typing of the override method is identical to overridden method and thus I attempted to just remove the overridden method. However I am leaving this here to track the bug in case it is an issue in the future |
…overrides of same methods by HTMLDocument The open(...), close(), write(...) and writeln(...) methods on Document are now part of the standard and have been moved to w3c_dom1.js to reflect this. The typing of Document.prototype.close has been aligned with the specification and with the overriding close methods in HTMLDocument. The overrides of close(), write() and writeln() in HTMLDocument have been removed. This is done due to limitations of the jsinterop-generator tool that is more fully described in google/jsinterop-generator#35 While the specifications explicitly indicate that these overrides are present and annotates (requiring the [OverrideBuiltins] attribute be applied to the containing interface in WebIDL) it is not expected that this has any practical impact on programs type checking against the externs.
I don't think we will fix that. The error occurs because there is an problem in the extern file. You should not override a method with an identical signature. I keep it open in case of there is another side effect I'm not thinking of. |
…overrides of same methods by HTMLDocument The open(...), close(), write(...) and writeln(...) methods on Document are now part of the standard and have been moved to w3c_dom1.js to reflect this. The typing of Document.prototype.close has been aligned with the specification and with the overriding close methods in HTMLDocument. The overrides of close(), write() and writeln() in HTMLDocument have been removed. This is done due to limitations of the jsinterop-generator tool that is more fully described in google/jsinterop-generator#35 While the specifications explicitly indicate that these overrides are present and annotates (requiring the [OverrideBuiltins] attribute be applied to the containing interface in WebIDL) it is not expected that this has any practical impact on programs type checking against the externs. Closes #3399. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=251955300
It is perfectly valid closure typing to tighten the types in an override. i.e. you imagine going from Particularly as the only way to fix this probably involves searching type hierarchies or externalizing these synthesized types whichs is a lot of work for something that is not currently used. |
As part of an attempt to whittle down the remaining errors in
google/elemental2
builds I tried to define the standardizedDocument.prototype.write
in an extern accessible via Elemental2.The extern looks something like:
This is overridden in
w3c_dom2.js
withUnfortunately
jsinterop-generator
generates the overlay methods for union types inDocument
class likeand attempts to define a similar but different overlay in
HTMLDocument
likeThere does not seem to get the overriding method to use the union type and thus the overlay methods declared by the overridden method. Thus a compile error.
The text was updated successfully, but these errors were encountered: