Skip to content
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

Implement dput checks robustly #27258

Closed
4 tasks done
vsmenon opened this issue Sep 6, 2016 · 3 comments
Closed
4 tasks done

Implement dput checks robustly #27258

vsmenon opened this issue Sep 6, 2016 · 3 comments
Assignees
Labels
P2 A bug or feature request we're likely to work on soundness type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dev-compiler

Comments

@vsmenon
Copy link
Member

vsmenon commented Sep 6, 2016

From @vsmenon on May 8, 2015 16:58

dput needs to check:

  • NSM for non-existent fields (for JS types too?)
  • Writability (final fields, methods, no setter)
  • Type check - value passed in must be a subtype of field / setter type

dload needs to check:

  • NSM for non-existent fields (for JS types too?)

Copied from original issue: dart-archive/dev_compiler#170

@vsmenon vsmenon added web-dev-compiler soundness type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Sep 6, 2016
@vsmenon vsmenon modified the milestone: 1.50 Jan 6, 2017
@vsmenon vsmenon added the P2 A bug or feature request we're likely to work on label Jan 9, 2017
@dgrove dgrove modified the milestones: 1.50, 1.23 Feb 14, 2017
@jacob314
Copy link
Member

Updated checkboxes

@vsmenon vsmenon modified the milestone: 1.23 Mar 6, 2017
@jmesserly jmesserly self-assigned this Apr 7, 2017
@jmesserly
Copy link

jmesserly commented Apr 26, 2017

Just tested, all of the writability checks work except final fields. We are checking the type though, which is interesting.

$ cat test.dart
class C {
  final x = "hello";
  get y => ", ";
  m() => "world!";
}

main() {
  dynamic c = new C();
  print(c.x + c.y + c.m());

  try { c.x = 1; } catch(e) { print('c.x= throws $e'); }
  try { c.x = '1'; } catch(e) { print('c.x= throws $e'); }
  try { c.y = '2'; } catch(e) { print('c.y= throws $e'); }
  try { c.m = '3'; } catch(e) { print('c.m= throws $e'); }
  print(c.x);
  print(c.y);
  print(c.m);
}
$ ddc test.dart 
hello, world!
c.x= throws Type 'int' is not a subtype of type 'String'
c.y= throws NoSuchMethodError : method not found: 'Symbol("y")'
Receiver: Instance of 'C'
Arguments: ["2"]
c.m= throws NoSuchMethodError : method not found: 'Symbol("m")'
Receiver: Instance of 'C'
Arguments: ["3"]
1
, 
Closure: () -> dynamic from: function () { [native code] }

edit: the symbols for setters in nSM is wrong, I've filed that over here: #29486

@jmesserly
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 A bug or feature request we're likely to work on soundness type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dev-compiler
Projects
None yet
Development

No branches or pull requests

4 participants