Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1254)

Issue 2170643003: Add an alwaysThrows annotation to indicate that a function always throws. (Closed)

Created:
4 years, 5 months ago by srawlins
Modified:
3 years, 6 months ago
Reviewers:
kevmoo, Brian Wilkerson
CC:
reviews_dartlang.org
Base URL:
git@github.com:dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Add an alwaysThrows annotation to indicate that a function always throws. BUG=https://github.com/dart-lang/sdk/issues/17999 R=brianwilkerson@google.com Committed: https://github.com/dart-lang/sdk/commit/c6d6a69a7876c2b3d637472f4f8594f18de82263

Patch Set 1 #

Total comments: 2

Patch Set 2 : Add comments about inheritence and enforcement #

Patch Set 3 : Rebase #

Total comments: 2

Patch Set 4 : Alphabetize #

Unified diffs Side-by-side diffs Delta from patch set Stats (+34 lines, -0 lines) Patch
M pkg/meta/lib/meta.dart View 1 2 3 2 chunks +34 lines, -0 lines 0 comments Download

Messages

Total messages: 14 (2 generated)
srawlins
Better late than never! Bug is 2+ years old.
4 years, 5 months ago (2016-07-21 14:54:20 UTC) #2
Brian Wilkerson
https://codereview.chromium.org/2170643003/diff/1/pkg/meta/lib/meta.dart File pkg/meta/lib/meta.dart (right): https://codereview.chromium.org/2170643003/diff/1/pkg/meta/lib/meta.dart#newcode41 pkg/meta/lib/meta.dart:41: /// always return a / value. The annotation shows ...
4 years, 5 months ago (2016-07-21 15:39:25 UTC) #3
srawlins
On 2016/07/21 15:39:25, Brian Wilkerson wrote: > https://codereview.chromium.org/2170643003/diff/1/pkg/meta/lib/meta.dart > File pkg/meta/lib/meta.dart (right): > > https://codereview.chromium.org/2170643003/diff/1/pkg/meta/lib/meta.dart#newcode41 ...
4 years, 5 months ago (2016-07-22 17:21:00 UTC) #4
Brian Wilkerson
> > The second is to declare the developer's intent that the method ought to ...
4 years, 5 months ago (2016-07-22 21:57:02 UTC) #5
srawlins
On 2016/07/22 21:57:02, Brian Wilkerson wrote: > > > The second is to declare the ...
4 years, 4 months ago (2016-07-28 13:04:31 UTC) #6
srawlins
4 years, 4 months ago (2016-07-28 13:04:45 UTC) #7
srawlins
On 2016/07/28 13:04:45, srawlins wrote: Hi Brian, I think this is up-to-date. Would you mind ...
3 years, 6 months ago (2017-06-13 17:57:01 UTC) #8
Brian Wilkerson
lgtm https://codereview.chromium.org/2170643003/diff/40001/pkg/meta/lib/meta.dart File pkg/meta/lib/meta.dart (right): https://codereview.chromium.org/2170643003/diff/40001/pkg/meta/lib/meta.dart#newcode73 pkg/meta/lib/meta.dart:73: /// addition, the / annotation reveals that any ...
3 years, 6 months ago (2017-06-13 19:35:19 UTC) #9
srawlins
https://codereview.chromium.org/2170643003/diff/40001/pkg/meta/lib/meta.dart File pkg/meta/lib/meta.dart (right): https://codereview.chromium.org/2170643003/diff/40001/pkg/meta/lib/meta.dart#newcode73 pkg/meta/lib/meta.dart:73: /// addition, the / annotation reveals that any statements ...
3 years, 6 months ago (2017-06-13 19:42:05 UTC) #10
srawlins
Committed patchset #4 (id:60001) manually as c6d6a69a7876c2b3d637472f4f8594f18de82263 (presubmit successful).
3 years, 6 months ago (2017-06-13 19:42:30 UTC) #12
kevmoo
Is there work planned so that calls to such a method are treated by analysis ...
3 years, 6 months ago (2017-06-13 20:14:35 UTC) #13
srawlins
3 years, 6 months ago (2017-06-13 20:50:55 UTC) #14
Message was sent while issue was closed.
On 2017/06/13 20:14:35, kevmoo wrote:
> Is there work planned so that calls to such a method are treated by analysis
as
> a throw?

I plan to support this in the DEAD_CODE detection in analyzer. Specifically:

String someQuestion(something) {
  if (something.whatever) {
    fail("whatever was a thing");
  } else {
    return something.someString;
  }
}

Right now this gets a DEAD_CODE. Even though package:test's fail() always
throws.

Someone could also write a check that a method does, in fact, always throw. I
hadn't really planned to write this, though.

Powered by Google App Engine
This is Rietveld 408576698