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

Consider better errors for expressions that really shouldn't be statements #615

Closed
DartBot opened this issue Nov 28, 2011 · 11 comments
Closed
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-as-intended Closed as the reported issue is expected behavior

Comments

@DartBot
Copy link

DartBot commented Nov 28, 2011

This issue was originally filed by jimhug@google.com


I keep making this mistake:
  child == newChild vs. child = newChild.

By default, the compiler should generate a warning here - even though it is possible that the developer is completely insane and wants to rely on the side-effect of an == method. In general, I think that expression statements that are not either assignments or method calls should generate a warning.

@jmesserly
Copy link

Agreed! We have this warning if you just have a variable, but should extend it to other unlikely-to-be-statement things

@anders-sandholm
Copy link
Contributor

Removed Area-Frog label.
Added Area-Dart2JS, FromAreaFrog labels.

@kasperl
Copy link

kasperl commented Jun 12, 2012

Removed FromAreaFrog label.
Changed the title to: "Consider better errors for expressions that really shouldn't be statements".

@kasperl
Copy link

kasperl commented Sep 3, 2012

Added this to the Later milestone.

@kasperl
Copy link

kasperl commented Oct 17, 2012

Removed this from the Later milestone.

@kasperl
Copy link

kasperl commented Oct 17, 2012

Added this to the M2 milestone.
Removed Priority-Low label.
Added Priority-Medium label.

@kasperl
Copy link

kasperl commented Oct 17, 2012

Removed Priority-Medium label.
Added Priority-Low label.

@kasperl
Copy link

kasperl commented Oct 17, 2012

Removed Type-Enhancement label.
Added Type-Defect label.

@peter-ahe-google
Copy link
Contributor

Removed this from the M2 milestone.
Added this to the Later milestone.
Removed Priority-Low label.
Added Priority-Medium label.

@kasperl
Copy link

kasperl commented May 23, 2013

Added TriageForM5 label.

@kasperl
Copy link

kasperl commented May 28, 2013

For now, we're not trying to mandate warnings for these kind of things. If static analysis tools want to provide suggestions / hints in addition to the spec mandated warnings, that seems fine.


Removed this from the Later milestone.
Removed Area-Dart2JS, TriageForM5 labels.
Added Area-Language, AsDesigned labels.

@DartBot DartBot added area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). Type-Defect closed-as-intended Closed as the reported issue is expected behavior labels May 28, 2013
dart-bot pushed a commit that referenced this issue Oct 25, 2019
Update spec_parser to enable configurableUri in deferred imports,
make cascade syntax compositional, include `extension` declarations,
add `late` as a built-in identifier, and reorder the lexical rules for
single words such that they are grouped into reserved words, built-in
identifiers, and "other words known by the grammar".

Cf. language issue #615, #627, #628, #638.

Change-Id: If60b2ba2ca0e7d4bbc9b4e886857f657fb14c809
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121991
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
copybara-service bot pushed a commit that referenced this issue May 20, 2022
Changes:
```
> git log --format="%C(auto) %h %s" c1eb6cb..b149f80
 https://dart.googlesource.com/protobuf.git/+/b149f80 Remove the top level analysis_options.yaml file (#656)
 https://dart.googlesource.com/protobuf.git/+/8f6f307 Fix comment syntax
 https://dart.googlesource.com/protobuf.git/+/665f7b0 Remove trailing whitespace in protobuf/LICENSE
 https://dart.googlesource.com/protobuf.git/+/9ffbaf2 Fix default list type for frozen messages (#654)
 https://dart.googlesource.com/protobuf.git/+/a68bb5a Fix Fixed32 to be parsed as unsigned when parsing proto3 protos (#655)
 https://dart.googlesource.com/protobuf.git/+/6957c98 Convert the field started with underscore and digit to a legal name (#651)
 https://dart.googlesource.com/protobuf.git/+/71defca Account for double.infinity and double.nan in json serializers (#652)
 https://dart.googlesource.com/protobuf.git/+/5a48349 Allow `Timestamp.toDateTime()` to return a `DateTime` in local timezone (#653)
 https://dart.googlesource.com/protobuf.git/+/117e869 Make the toString of enums be the value if names are omitted (#649)
 https://dart.googlesource.com/protobuf.git/+/88c4016 Align the hashCode of a message with an empty unknown field-set with that of no unknown field set (#648)
 https://dart.googlesource.com/protobuf.git/+/eed09c4 Fix proto3 repeated field encoding without packed option (#635)
 https://dart.googlesource.com/protobuf.git/+/8f587b1 Simplify `_FieldSet` getters (#646)
 https://dart.googlesource.com/protobuf.git/+/494f189 Fix compile-protos.sh interpreter (#645)
 https://dart.googlesource.com/protobuf.git/+/5e1a422 Fix typo in protobuf-0.9.0+1 changelog
 https://dart.googlesource.com/protobuf.git/+/46df68a Add `UseResult` annotation to `rebuild` (#631)
 https://dart.googlesource.com/protobuf.git/+/ff5304f Migrate protoc_plugin to null safety (#642)
 https://dart.googlesource.com/protobuf.git/+/657197d Fix typo in GeneratedMessage.copyWith documentation (#641)
 https://dart.googlesource.com/protobuf.git/+/e30a522 Fix sharing coded buffer bytes when parsing `bytes` fields (#640)
 https://dart.googlesource.com/protobuf.git/+/810b166 Clear unknown field when setting an extension field with the same tag (#639)
 https://dart.googlesource.com/protobuf.git/+/d30623b Treat empty and uninitialized Maps the same in equality checks (#638)
 https://dart.googlesource.com/protobuf.git/+/4fe3ee4 Make `MapFieldInfo` key and value types non-nullable (#600)
 https://dart.googlesource.com/protobuf.git/+/c26ac34 Add grpc example to protoc_plugin README (#514)
 https://dart.googlesource.com/protobuf.git/+/c35d787 Revert changes to reserved names to maintain backwards compat (#636)
 https://dart.googlesource.com/protobuf.git/+/146b186 Remove unused `GeneratedMessage` constructors (#634)
 https://dart.googlesource.com/protobuf.git/+/1b12ac9 Remove a closure in `_FieldSet.hashCode` (#633)
 https://dart.googlesource.com/protobuf.git/+/5731242 Minor fix in query_bench set_nested_value benchmark: (#630)
 https://dart.googlesource.com/protobuf.git/+/767ce81 Remove fold() closures from `FieldSet._hashCode`. (#554)
 https://dart.googlesource.com/protobuf.git/+/99bc541 protoc_plugin README fixes and tweaks: (#617)
 https://dart.googlesource.com/protobuf.git/+/e282e17 protobuf benchs: invoke protoc once with all protos (#623)
 https://dart.googlesource.com/protobuf.git/+/bef672b protobuf benchs: fix old --trust-type-annotations flag (#622)
 https://dart.googlesource.com/protobuf.git/+/d072e5f dependabot: check for updates monthly (#620)
 https://dart.googlesource.com/protobuf.git/+/96bdf38 Fix TypeRegistry passing when unpacking nested Any messages from JSON (#568)
 https://dart.googlesource.com/protobuf.git/+/4ec722a Correctly combine hash codes for repeated enums. (#556)
 https://dart.googlesource.com/protobuf.git/+/b96dc21 Testing: don't return static methods in findMemberNames (#618)
 https://dart.googlesource.com/protobuf.git/+/09e8a8d Update protobuf/benchmarks README for #553
 https://dart.googlesource.com/protobuf.git/+/3ef4539 Add a benchmark for computing hashCodes. (#553)
 https://dart.googlesource.com/protobuf.git/+/d232e6e Tweak READMEs: (#610)
 https://dart.googlesource.com/protobuf.git/+/0f01fa9 Update protobuf pubspec.yaml (#616)
 https://dart.googlesource.com/protobuf.git/+/a10426b Update protoc_plugin pubspec.yaml (#615)
 https://dart.googlesource.com/protobuf.git/+/a0021c7 Make `protoName` unCamelCase lazy (#606)
 https://dart.googlesource.com/protobuf.git/+/ded1ac7 Document map key and value fields (#603)
 https://dart.googlesource.com/protobuf.git/+/8792f2a Remove redundant check in PbMap equality check (#604)
 https://dart.googlesource.com/protobuf.git/+/b7f9569 Tweak BuilderInfo and FieldInfo docs: (#597)
 https://dart.googlesource.com/protobuf.git/+/6f85c32 Remove a redundant cast (#598)
 https://dart.googlesource.com/protobuf.git/+/3df8669 Latest mono_repo (#601)
 https://dart.googlesource.com/protobuf.git/+/9da84ae Fix a potential issue in CodedBufferWriter (#594)
 https://dart.googlesource.com/protobuf.git/+/6be405f Remove old and unused test file (#589)
 https://dart.googlesource.com/protobuf.git/+/900cef5 Fix protoc_plugin run-tests make rule (#586)
 https://dart.googlesource.com/protobuf.git/+/2546269 Fix rounding when handling negative timestamps (#580)
 https://dart.googlesource.com/protobuf.git/+/8afce8d Fix Readme `pub get` instead of `pub install`. (#486)
 https://dart.googlesource.com/protobuf.git/+/782fd24 Avoid runtime function type check in lazily created singleton creator functions (#574)
 https://dart.googlesource.com/protobuf.git/+/a7e75cb Update README.md
 https://dart.googlesource.com/protobuf.git/+/23136dc Version bump (#563)
 https://dart.googlesource.com/protobuf.git/+/18346f5 Convert null keys and values to default when parsing map entries (#536)
 https://dart.googlesource.com/protobuf.git/+/bb4cf0b Bump to latest mono_repo - use latest actions (#561)
 https://dart.googlesource.com/protobuf.git/+/835ab75 Remove unneeded imports
 https://dart.googlesource.com/protobuf.git/+/ef733ac latest mono_repo
 https://dart.googlesource.com/protobuf.git/+/ecfb862 Fix test for latest analysis (#543)
 https://dart.googlesource.com/protobuf.git/+/26a0a26 fix insecure link in protoc_plugin readme
 https://dart.googlesource.com/protobuf.git/+/444e855 Bump dart-lang/setup-dart from 1.1 to 1.2 (#535)
 https://dart.googlesource.com/protobuf.git/+/d3e0e4a Fix analysis options
 https://dart.googlesource.com/protobuf.git/+/cf29280 Fix comment references

```

Diff: https://dart.googlesource.com/protobuf.git/+/c1eb6cb51af39ccbaa1a8e19349546586a5c8e31~..b149f801cf7a5e959cf1dbf72d61068ac275f24b/

Tested: relying on existing SDK and protobuf tests
Change-Id: I7f89b998a0aba13999d180ee9814a26a5f1d054d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245228
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
copybara-service bot pushed a commit that referenced this issue Apr 3, 2023
…s, markdown, matcher, mockito, path, pool, source_map_stack_trace, sse, stream_channel, string_scanner, test, test_reflective_loader, tools, typed_data, webdev

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

cli_util (https://github.com/dart-lang/cli_util/compare/91747f7..6c318c2):
  6c318c2  2023-04-02  dependabot[bot]  Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (#81)
  df83fb5  2023-04-02  dependabot[bot]  Bump actions/checkout from 3.3.0 to 3.5.0 (#80)

collection (https://github.com/dart-lang/collection/compare/0d0e184..30fd0f8):
  30fd0f8  2023-04-02  dependabot[bot]  Bump actions/checkout from 3.3.0 to 3.5.0 (#277)

dartdoc (https://github.com/dart-lang/dartdoc/compare/0746cda..9be04e0):
  9be04e0c  2023-03-28  Jonas Finnemann Jensen  Allow ID attributes on headings when running with --sanitize-html (#3358)
  8785dd24  2023-03-27  dependabot[bot]  Bump actions/checkout from 3.3.0 to 3.5.0 (#3377)
  0944fa32  2023-03-27  dependabot[bot]  Bump github/codeql-action from 2.2.6 to 2.2.9 (#3379)
  e318d34f  2023-03-27  dependabot[bot]  Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (#3378)

ffi (https://github.com/dart-lang/ffi/compare/32f5eef..04fa38a):
  04fa38a  2023-04-03  Daco Harkes  test zero termination of Utf8 string (#147)
  eb93bbb  2023-04-03  dependabot[bot]  Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (#188)
  2a6b643  2023-04-03  dependabot[bot]  Bump actions/checkout from 3.3.0 to 3.5.0 (#189)

intl (https://github.com/dart-lang/intl/compare/fca552f..a958db0):
  a958db0  2023-03-29  Googler  Internal change

json_rpc_2 (https://github.com/dart-lang/json_rpc_2/compare/0280ac6..aea3bea):
  aea3bea  2023-03-28  Kevin Moore  Fix analysis, bump min SDK to 2.19 (#93)

lints (https://github.com/dart-lang/lints/compare/dfded5e..f09399a):
  f09399a  2023-04-02  dependabot[bot]  Bump actions/checkout from 3.3.0 to 3.5.0 (#110)
  9581bab  2023-03-25  Parker Lougheed  Fix 'recommended' spelling in README (#109)
  c92e1ca  2023-03-23  Michael Thomsen  Update README.md (#108)
  7134608  2023-02-01  dependabot[bot]  Bump actions/checkout from 3.2.0 to 3.3.0 (#98)

markdown (https://github.com/dart-lang/markdown/compare/ecbffa9..d437c85):
  d437c85  2023-04-02  dependabot[bot]  Bump actions/checkout from 3.3.0 to 3.5.0 (#529)
  3550fe6  2023-04-01  dependabot[bot]  Bump subosito/flutter-action from 2.8.0 to 2.10.0 (#528)
  d1b7907  2023-04-01  dependabot[bot]  Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (#527)
  0daf231  2023-03-31  le.chang  Footnote support (#441)
  b96bc08  2023-03-30  Jonas Finnemann Jensen  Prepare a release of 7.0.2 (#526)

matcher (https://github.com/dart-lang/matcher/compare/dc310d9..61f4347):
  61f4347  2023-03-21  Nate Bosch  Prepare to publish (#214)

mockito (https://github.com/dart-lang/mockito/compare/ed5bd84..28e8eda):
  28e8eda  2023-04-02  dependabot[bot]  Bump dart-lang/setup-dart from 1.4.0 to 1.5.0
  ccb9abf  2023-04-01  dependabot[bot]  Bump actions/checkout from 3.3.0 to 3.5.0
  65ee0c4  2023-03-23  Nate Bosch  Expand pub constraint on test_api (#615)
  e6ea7ad  2023-03-23  Nate Bosch  GitHub Sync (#614)

path (https://github.com/dart-lang/path/compare/24b58a2..cd37179):
  cd37179  2023-04-02  dependabot[bot]  Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (#139)

pool (https://github.com/dart-lang/pool/compare/694cfd8..338bfb4):
  338bfb4  2023-04-02  dependabot[bot]  Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (#67)

source_map_stack_trace (https://github.com/dart-lang/source_map_stack_trace/compare/45ea368..08a81a8):
  08a81a8  2023-04-02  dependabot[bot]  Bump actions/checkout from 3.3.0 to 3.5.0 (#37)
  4cbe06e  2023-04-02  dependabot[bot]  Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (#36)

sse (https://github.com/dart-lang/sse/compare/8c03b73..8c3efdc):
  8c3efdc  2023-04-02  dependabot[bot]  Bump actions/checkout from 3.3.0 to 3.5.0 (#80)
  e35336a  2023-04-02  dependabot[bot]  Bump nanasess/setup-chromedriver from 1.1.0 to 2.0.0 (#81)

stream_channel (https://github.com/dart-lang/stream_channel/compare/a20ccd4..fe0f5e4):
  fe0f5e4  2023-04-02  dependabot[bot]  Bump actions/checkout from 3.3.0 to 3.5.0 (#89)

string_scanner (https://github.com/dart-lang/string_scanner/compare/29e471e..f7a656f):
  f7a656f  2023-04-02  dependabot[bot]  Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (#56)
  fe8c301  2023-04-02  dependabot[bot]  Bump actions/checkout from 3.3.0 to 3.5.0 (#55)

test (https://github.com/dart-lang/test/compare/cc0598b..a01b185):
  a01b185e  2023-03-30  Nate Bosch  More smoothly handle missing compiler info (#1980)
  b24b4668  2023-03-27  Daco Harkes  Support native assets (#1975)
  c3828267  2023-03-23  Nate Bosch  Prepare to publish (#1974)
  9035bba8  2023-03-21  Parker Lougheed  Use deps.dev for OpenSSF scorecard results link (#1976)

test_reflective_loader (https://github.com/dart-lang/test_reflective_loader/compare/c4c2d5c..a85a930):
  a85a930  2023-04-01  dependabot[bot]  Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (#46)
  27bc418  2023-04-01  dependabot[bot]  Bump actions/checkout from 3.3.0 to 3.5.0 (#47)

tools (https://github.com/dart-lang/tools/compare/fb2dada..d40ca93):
  d40ca93  2023-04-03  dependabot[bot]  Bump actions/labeler from 4.0.2 to 4.0.3 (#66)
  4185d6d  2023-04-03  dependabot[bot]  Bump coverallsapp/github-action from 1.2.4 to 2.0.0 (#65)
  b14d5be  2023-04-03  dependabot[bot]  Bump actions/checkout from 3.3.0 to 3.5.0 (#64)

typed_data (https://github.com/dart-lang/typed_data/compare/f858046..d85363d):
  d85363d  2023-04-02  dependabot[bot]  Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (#62)
  0f57d9b  2023-04-02  dependabot[bot]  Bump actions/checkout from 3.3.0 to 3.5.0 (#63)

webdev (https://github.com/dart-lang/webdev/compare/c2c8b17..b139649):
  b139649e  2023-03-31  Elliott Brooks  Don't show non-instantiated variables (#2061)
  8437f60a  2023-03-31  Elliott Brooks  Move project-specific getters to `TestProject` instead of `TestContext` (#2052)
  652e040c  2023-03-30  Elliott Brooks  Provide an app entrypoint to DWDS (#2047)
  0afc9eb4  2023-03-30  Elliott Brooks  Add Dart Code Metrics (#2055)
  5fcbb803  2023-03-29  Elliott Brooks  Apply `trailing-comma` lint (#2054)
  5bd21384  2023-03-28  Elliott Brooks  Skip failing webdev integration_test cases (#2051)
  2d8e9c23  2023-03-24  Elliott Brooks (she/her)  Adds a script for the release steps of `dwds` and `webdev` (#2049)
  afee8c74  2023-03-23  Elliott Brooks (she/her)  Reset `webdev`, `dwds`, `test_common` after publishing (#2048)
  4122b234  2023-03-22  Devon Carew  update to the latest mono_repo generated CI (#2044)
  2b6e9182  2023-03-22  Elliott Brooks (she/her)  Prepare Webdev for `3.0.3` release (#2046)
  c3cbd89b  2023-03-22  Elliott Brooks (she/her)  Prepare DWDS  for 18.0.2 release (#2045)
  bb22b3a0  2023-03-22  Anna Gringauze  Make debugger skip same locations in dart  during stepping. (#2043)
  b9499819  2023-03-20  Anna Gringauze  Prepare for variable names changes due to patterns support in DDC (#2042)

Change-Id: I5b8d591d1b906338564cf008f935b17f85ed2813
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292922
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@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-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-as-intended Closed as the reported issue is expected behavior
Projects
None yet
Development

No branches or pull requests

5 participants