-
Notifications
You must be signed in to change notification settings - Fork 29
#3180. Add JSExport tests. Part 2. #3251
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
eernstg
left a comment
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.
Commented on a bunch of typos. Awaiting further comments.
| } | ||
|
|
||
| void main() { | ||
| var jsET = createJSInteropWrapper<C>(ET(C())); |
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 actually eliminates the extension type entirely, because createJSInteropWrapper<C> expects an actual argument of type C, and ET is a subtype of C so that's fine.
Does it work if it is invoked as follows?:
var jsET = createJSInteropWrapper<ET>(ET(C()));This could actually yield a JavaScript object with members etMethod, etGetter, etSetter, and c which would invoke the extension type members with the underlying C object as the representation object.
Alternatively, it could be rejected as an error.
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.
Does it work if it is invoked as follows?:
var jsET = createJSInteropWrapper<ET>(ET(C()));
No, it's an error. Error: Type argument 'ET' needs to be an interface type.. That's why I had to use class C as a type argument.
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.
OK, but given that there is absolutely no difference between an instance of C and an instance of C which has been given the static type ET and upcasted to C, I'm not convinced that the use of ET shows anything. ;-)
sgrekhov
left a comment
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.
Thank you! Typos fixed. PTAL.
| } | ||
|
|
||
| void main() { | ||
| var jsET = createJSInteropWrapper<C>(ET(C())); |
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.
Does it work if it is invoked as follows?:
var jsET = createJSInteropWrapper<ET>(ET(C()));
No, it's an error. Error: Type argument 'ET' needs to be an interface type.. That's why I had to use class C as a type argument.
srujzs
left a comment
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.
LGTM % my comments.
sgrekhov
left a comment
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.
Updated to expect warnings. Also added SDK issue numbers. PTAL.
eernstg
left a comment
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.
LGTM.
2025-07-10 sgrekhov22@gmail.com dart-lang/co19#3180. Add JSExport tests. Part 3. (dart-lang/co19#3252) 2025-07-09 sgrekhov22@gmail.com dart-lang/co19#3180. Add JSExport tests. Part 2. (dart-lang/co19#3251) 2025-07-08 sgrekhov22@gmail.com dart-lang/co19#3180. Add additional `NullRejectionException` test (dart-lang/co19#3249) 2025-07-08 sgrekhov22@gmail.com dart-lang/co19#3180. Add JSExport tests. Part 1. (dart-lang/co19#3250) 2025-07-04 sgrekhov22@gmail.com Fixes dart-lang/co19#3245. Fix int to double conversion in jsNumber_t01.dart (dart-lang/co19#3248) 2025-07-04 sgrekhov22@gmail.com dart-lang/co19#3180. Add `NullRejectionException` tests (dart-lang/co19#3247) Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try,dart2js-minified-linux-d8-try Change-Id: I4b44a79d210d19153a464a9eadb86996d2876cf6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439840 Reviewed-by: Erik Ernst <eernst@google.com> Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Commit-Queue: Erik Ernst <eernst@google.com>
There are some tests in this PR that check the
@JSExportannotation when applied to extension types and extensions. The current behavior is that this annotation is a no-op when applied to an extension type or extension, and it produces a compile-time error when a member of an extension type or extension is annotated with this annotation. The tests are written accordingly. Please review.