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

Static analyzer treats a user-defined assert as an assert statement #3268

Closed
DartBot opened this issue May 28, 2012 · 6 comments
Closed

Static analyzer treats a user-defined assert as an assert statement #3268

DartBot opened this issue May 28, 2012 · 6 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
Milestone

Comments

@DartBot
Copy link

DartBot commented May 28, 2012

This issue was originally filed by ms...@unipro.ru


Assert is a built-in identifier and therefore can be used as a function name. The spec in the section 11.15 says: "If a lexically visible declaration named assert is in scope, an assert statement assert(e); is interpreted as an expression statement (assert(e)); ."
So, the following code should give only the warning about using a built-in identifier as a name for user-defined function:

assert(p) => print(p);

main() {
  assert('not a boolean');
}

But dartc(r8026) still treats this as an assert statement and gives the warning: "assert requires 'bool' expression or '() -> bool' function"

@kasperl
Copy link

kasperl commented May 29, 2012

Added Area-Analyzer, Triaged labels.

@danrubel
Copy link

danrubel commented Jun 4, 2012

Added this to the M1 milestone.

@scheglov
Copy link
Contributor

scheglov commented Jun 5, 2012

Set owner to @scheglov.
Added Accepted label.

@scheglov
Copy link
Contributor

scheglov commented Jun 5, 2012

Issue #2443 has been merged into this issue.

@scheglov
Copy link
Contributor

scheglov commented Jun 5, 2012

@scheglov
Copy link
Contributor

scheglov commented Jun 5, 2012

@DartBot DartBot added Type-Defect area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Jun 5, 2012
@DartBot DartBot added this to the M1 milestone Jun 5, 2012
copybara-service bot pushed a commit that referenced this issue Jan 27, 2022
Changes:
```
> git log --format="%C(auto) %h %s" dcb6aba..8f5ab7b
 https://dart.googlesource.com/pub.git/+/8f5ab7b1 Avoid raceconditions in `global activate`, `run` and `global run` (#3285)
 https://dart.googlesource.com/pub.git/+/6e03ec02 Support multiple packages in 'dart pub add' (#3283)
 https://dart.googlesource.com/pub.git/+/1a298f4d Fix --verbose doc, and accept verboseness setting from embedder (#3279)
 https://dart.googlesource.com/pub.git/+/5bda798c Avoid race condition for hosted source on package extraction (#3277)
 https://dart.googlesource.com/pub.git/+/17c5addb Error on acquireDependencies when the root pubspec has an unknown sdk in the environment. (#3271)
 https://dart.googlesource.com/pub.git/+/0a32ae4a folder/* should not ignore the folder itself, only the contents (#3267)
 https://dart.googlesource.com/pub.git/+/44b785aa Normalize file names for tar.gz (#3268)
 https://dart.googlesource.com/pub.git/+/2fd6b5f0 Fix repository specification: isRetracted -> retracted (#3249)
 https://dart.googlesource.com/pub.git/+/0fc71db4 Write log trace to $PUB_CACHE/log/pub_log.txt when crashing (#3240)

```

Diff: https://dart.googlesource.com/pub.git/+/dcb6abac2d7d43258c03b348be42bf4aab9529b1~..8f5ab7b1aba3b9f66b56246d77e167990339d317/
Change-Id: I54f1fde0f50ca19ca036bb1e6d9b166455031183
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229542
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
copybara-service bot pushed a commit that referenced this issue Jan 19, 2023
This is an accumulation of 12 commits to dartdoc, imported into
dart-lang/sdk across 4 commits, noted below. I've also stripped out
the changes made to any other repository in this DEPS file.

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

From cabf333:
dartdoc (https://github.com/dart-lang/dartdoc/compare/eb90a44..1f42216):
  1f422163  2022-12-13  Sam Rawlins  Bump to 6.1.5 (#3274)

From a3b7a76:
  eb90a44c  2022-12-12  Sam Rawlins      Remove annotations from the features section of each element (#3268)
  16126376  2022-12-12  Parker Lougheed  Don't show null in search results when no description (#3273)
  3ff7aa75  2022-12-12  Sam Rawlins      Fix search arrows by using a flat list of suggestions (#3271)
  90264fb4  2022-12-12  dependabot[bot]  Bump github/codeql-action from 2.1.35 to 2.1.36 (#3270)
  bede500d  2022-12-12  Sam Rawlins      Fix remote linking in 2.18 and 3.0.0 (#3267)

From 0c14719:
dartdoc (https://github.com/dart-lang/dartdoc/compare/4d7dc93..f2bb6e9):
  f2bb6e92  2022-12-07  Sam Rawlins  Bump to 6.1.4 (#3266)

From 3a1d7c7:
dartdoc (https://github.com/dart-lang/dartdoc/compare/dc502d0..4d7dc93):
  4d7dc93b  2022-12-05  dependabot[bot]  Bump github/codeql-action from 2.1.31 to 2.1.35 (#3263)
  bcf8b6e8  2022-12-05  Parker Lougheed  Weight enums the same as classes for searching (#3260)
  7d95578b  2022-12-04  Parker Lougheed  Update template descriptions (#3258)
  d558f043  2022-12-04  Parker Lougheed  Fix error when using base element href (#3256)
  c3663762  2022-12-04  Parker Lougheed  Add unnecessary override ignore to fix build (#3257)

Change-Id: I21fc9ecd36db78b7ef420bd179af4907e667557d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279320
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Chisholm <kevinjchisholm@google.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
Projects
None yet
Development

No branches or pull requests

4 participants