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

ConstantReader.revive() crashes when attempting to revive a type #411

Open
jbdeboer opened this issue Mar 21, 2019 · 2 comments
Open

ConstantReader.revive() crashes when attempting to revive a type #411

jbdeboer opened this issue Mar 21, 2019 · 2 comments
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@jbdeboer
Copy link

e.g. Adding a test to constants_test.dart:

@TypeWrapper(String)
class Example {}

class TypeWrapper {
  final Type t;
  const TypeWrapper(this.t);
}

test('should not crash when resolving types', () {
  expect(typeWrapperConstant.read('t').revive(), isNull /* or anything */)
});

throws the following:

  Bad state: No element
  dart:core                                                               List.first
  package:source_gen/src/constants/revive.dart 97:21                      reviveInstance
  package:source_gen/src/constants/reader.dart 276:25                     _DartObjectConstant.revive
  test/constants_test.dart 356:49  main.<fn>.<fn>

I don't know what the correct behaviour is, but I know the code should not crash.

@jbdeboer
Copy link
Author

@matanlurey who wrote the reviver

@kevmoo kevmoo added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Apr 25, 2019
@kevmoo
Copy link
Member

kevmoo commented Apr 26, 2019

Or even a better error would be nice...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

2 participants