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

dartc has broken type checking in some cases #925

Closed
DartBot opened this issue Dec 20, 2011 · 1 comment
Closed

dartc has broken type checking in some cases #925

DartBot opened this issue Dec 20, 2011 · 1 comment
Labels
closed-not-planned Closed as we don't intend to take action on the reported issue

Comments

@DartBot
Copy link

DartBot commented Dec 20, 2011

This issue was originally filed by [email protected]


In checked mode (dartc --enable_type_checks), there is a bug in runtime type checking in some cases. Here's a test that exercises it

TypeChecksInFactoryMethods.dart

interface Foo<T> default Bar {
  Foo.from();
}

class Bar<T> implements Foo<T> {
  Bar() {}

  factory Bar.from() {
    var func = (T arg) { print(arg); }; // If T is not a string, runtime checks should fail
    func("Hello World!");
    return new Bar<T>();
  }
}

main() {
  Foo value;
  value = new Foo<String>.from();

  bool gotError = false;

  try {
    value = new Foo<int>.from();
  } catch (TypeError e) {
    gotError = true;
  }
  Expect.equals(true, gotError);
}

Basically, getting type arguments into the hoisted methods from a factory method hasn't been worked out. Factory methods get their type arguments passed in as the first parameter, for other methods, the arguments are passed on a property of 'this' but in these hoisted methods from a factory, 'this' is set to Dart$Null.

@scheglov
Copy link
Contributor

We are removing code generation from DartC.


Added WontFix label.

@kevmoo kevmoo added closed-not-planned Closed as we don't intend to take action on the reported issue and removed resolution-wont_fix labels Mar 1, 2016
copybara-service bot pushed a commit that referenced this issue May 10, 2023
…ed_data, webdev, yaml

Revisions updated by `dart tools/rev_sdk_deps.dart`.

csslib (https://github.com/dart-lang/csslib/compare/923edf0..c4e904c):
  c4e904c  2023-05-10  Devon Carew  rev for publishing (#179)
  c9e47d0  2023-05-10  Kevin Moore  Require Dart 2.19, latest lints, skin hanging test (#175)
  3976e6f  2023-05-10  Devon Carew  address an issue parsing font names (#168)
  a337a9a  2023-05-10  Devon Carew  fixed CssPrinter pretty print indent levels (#169)

ffi (https://github.com/dart-lang/ffi/compare/1a859e0..7f4acbd):
  7f4acbd  2023-05-09  Devon Carew  Rev pubspec and update changelog (#194)

http (https://github.com/dart-lang/http/compare/406ce74..db84d12):
  db84d12  2023-05-10  Brian Quinlan  Require the release version of Dart 3.0.0 (#925)

leak_tracker (https://github.com/dart-lang/leak_tracker/compare/fc14e36..46a1fa0):
  46a1fa0  2023-05-09  Polina Cherkasova  Make sure leak tracker does not fail in case of duplicates. (#60)

mime (https://github.com/dart-lang/mime/compare/cd8001e..57fbf6e):
  57fbf6e  2023-05-09  Dimitar Petrov  Add m4b mime type (#92)

protobuf (https://github.com/dart-lang/protobuf/compare/9d7cf0d..05058a7):
  05058a7  2023-05-10  Ömer Sinan Ağacan  Apply internally enabled lints (#816)

test (https://github.com/dart-lang/test/compare/1d65501..0b306dd):
  0b306dd5  2023-05-09  Nate Bosch  Document behavior of explicit file path args (#2011)

typed_data (https://github.com/dart-lang/typed_data/compare/021f25a..921f5c0):
  921f5c0  2023-05-09  Devon Carew  add topics to the pubspec file (#65)

webdev (https://github.com/dart-lang/webdev/compare/fe5b975..469b105):
  469b1058  2023-05-10  Elliott Brooks  Update DCM workflow (#2106)

yaml (https://github.com/dart-lang/yaml/compare/1f39ffe..af3d8cd):
  af3d8cd  2023-05-10  Nate Bosch  Uncomment some tests (#145)

Change-Id: I97a7b284e01c4fde10b8cfc814d95ecc9686ddff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302448
Auto-Submit: Devon Carew <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-not-planned Closed as we don't intend to take action on the reported issue
Projects
None yet
Development

No branches or pull requests

3 participants