Skip to content

Fix text_style_text.dart to be Dart 2 compliant. #14559

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

Merged
merged 3 commits into from
Feb 8, 2018

Conversation

mraleph
Copy link
Member

@mraleph mraleph commented Feb 8, 2018

In Dart 2 mode we throw different exception: compiler generates
throw of a compilation error instead of runtime throwing
noSuchMethod.

In Dart 2 mode we throw different exception: compiler generates
throw of a compilation error instead of runtime throwing
noSuchMethod.
@mraleph mraleph requested a review from tvolkert February 8, 2018 15:13
@tvolkert
Copy link
Contributor

tvolkert commented Feb 8, 2018

Does the compilation error type exist in 2.0.0-dev19? If so, we could match against either type instead of a generic matcher.

/cc @Hixie

@mraleph
Copy link
Member Author

mraleph commented Feb 8, 2018

It's a private class _CompileTimeError and not a part of public Dart core libraries interface, so you can't match against it.

@tvolkert
Copy link
Contributor

tvolkert commented Feb 8, 2018

Hmm - is there no use case where someone would want to catch that error?

@mraleph
Copy link
Member Author

mraleph commented Feb 8, 2018

You can still catch an error, you just can't necessarily identify it.

If you want to write test against compiler you can do it using compiler APIs.

I mean you don't write C++ unit tests like this:

class C {
  C(intptr_t foo) : foo(foo) { }
  const intptr_t foo;
}

TEST(CanNotAssignToFoo) {
  C c(10);
  try {
    c.foo = 20;
  } catch (...) {
  }
}

you trust the compiler to handle this correctly.

@tvolkert
Copy link
Contributor

tvolkert commented Feb 8, 2018

Fair enough 😄

FYI, looks like analysis is failing:

[hint] 'throws' is deprecated and shouldn't be used. (packages/flutter/test/painting/text_style_test.dart, line 26, col 44)

Maybe use throwsA(const isInstanceOf<Error>())

@mraleph
Copy link
Member Author

mraleph commented Feb 8, 2018

@tvolkert done.

Copy link
Contributor

@tvolkert tvolkert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mraleph mraleph merged commit 90ddb23 into flutter:master Feb 8, 2018
@mraleph mraleph deleted the fix-text-style-test branch February 8, 2018 21:10
srawlins added a commit to srawlins/flutter that referenced this pull request Feb 9, 2018
* master: (88 commits)
  Upgrade dartdoc to 0.16.0. (flutter#14602)
  Reduce noise in xcodebuild stdout (flutter#14586)
  Add annotations to ignore analyzer errors on pre-dev.22 SDKs (flutter#14599)
  Roll engine to 337764e (flutter#14597)
  Roll engine with rolled dart (flutter#14538)
  Upgrade packages (flutter#14588)
  Change GlobalObjectKey.toString to strip away State<StatefulWidget>. (flutter#14558)
  Disable selection of the Android ARM64 target platform based on the attached device (flutter#14581)
  Add a flutter run option that can override the default target platform (flutter#14537)
  Fix message channel usage in few tests. (flutter#14557)
  Update documentation on how to test flutter_tools (flutter#14567)
  Fix text_style_text.dart to be Dart 2 compliant. (flutter#14559)
  Hide the NDK warning that should never happen with a regexp (flutter#14503)
  Fix iOS build which broke after the change to fuse --strong option into --preview-dart-2.
  Mark run_machine_concurrent_hot_reload as flaky (flutter#14563)
  Fuse --strong into --preview-dart-2 option.
  Partially fix Dart 2 issues in animated_icons.test. (flutter#14531)
  Strong mode fixes in tests (flutter#14520)
  Fix typo.
  Fix issues.
  ...
DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request May 14, 2018
In Dart 2 mode we throw different exception: compiler generates
throw of a compilation error instead of runtime throwing
noSuchMethod.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants