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

Language spec must describe semantics of leading newline in multiline string #240

Closed
DartBot opened this issue Oct 27, 2011 · 14 comments
Closed
Assignees
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language).
Milestone

Comments

@DartBot
Copy link

DartBot commented Oct 27, 2011

This issue was originally filed by olov.l...@gmail.com


A multiline string literal that doesn't include a leading newline (i.e. """hello...) is parsed correctly but when the literal includes at least one leading newline, the first of those is ignored. dartc doesn't have the bug.

main() {
  var str = """
hello
""";
  Expect.equals("\n", str[0], "str should include a leading newline");
}

@DartBot
Copy link
Author

DartBot commented Oct 27, 2011

This comment was originally written by @mhausner


This is actually a feature, not a bug. The language spec is lacking a description of this.

Making this a spec bug.


Changed the title to: "Language spec must describe semantics of leading newline in multiline string".

@DartBot
Copy link
Author

DartBot commented Oct 27, 2011

This comment was originally written by @mhausner


Added Area-Language label.

@DartBot
Copy link
Author

DartBot commented Oct 27, 2011

This comment was originally written by olov.l...@gmail.com


If this is a feature then there's still an implementation bug to fix (in dartc). Should I open another issue for that or will you adjust the title?

I'd like to discuss this feature more, starting a thread about that on misc.

@DartBot
Copy link
Author

DartBot commented Oct 27, 2011

This comment was originally written by olov.lass...@gmail.com


The discussion in misc suggests that this is actually a bug, not a feature. I suggest that the original title of the bugreport is restored and that it's assigned to VM.

I cannot retrieve the original title but it was something along the lines of "Dart VM ignores leading newline in multiline string".

<https://groups.google.com/a/dartlang.org/group/misc/browse_thread/thread/349f1cbb1bbb5ed4#>

@iposva-google
Copy link
Contributor

The current behaviour in the VM is as it was initially intended. Since this is not clear in the spec I am keeping this as a language/spec bug. The final resolution of this bug is either a clearer specification or it might be a change to the spec at which point we will update the VM implementation.


Set owner to @gbracha.
Added Accepted label.

@DartBot
Copy link
Author

DartBot commented Nov 9, 2011

This comment was originally written by olov.las...@gmail.com


I filed issue #398: "dartc should ignore leading newline in multi-line strings, like VM"

@scheglov
Copy link
Contributor

Yes, but what is NEWLINE?
According to spec right now:

NEWLINE:
\n' | \r'
;

  So, NEWLINE is '\n' or '\r'

  However 03_3_Strings_A03_t01.dart and all co19/src/LangGuideTest/03_Values tests use Windows style newline "\r\n".
  So, these tests are invalid, or spec should state that '\r\n' is also valid NEWLINE.

  JFYI, DartC right now skips leading '\n' (and only it).
  I can easily add '\r', but I can not add '\r\n' because it is not in spec.

@DartBot
Copy link
Author

DartBot commented Nov 30, 2011

This comment was originally written by olov.l...@gmail.com


dartc and the VM being consistent (accepting '\r\n' as newline) would be a good thing. The spec defining it clearly, likewise.

Right now try.dartlang fails on the example <http://try.dartlang.org/s/BYUf> which is a bit confusing to those trying out the language.

@anders-sandholm
Copy link
Contributor

Added apr30-triage label.

@anders-sandholm
Copy link
Contributor

Removed apr30-triage label.

@anders-sandholm
Copy link
Contributor

Added triage1 label.

@anders-sandholm
Copy link
Contributor

Added this to the M1 milestone.
Removed triage1 label.

@gbracha
Copy link
Contributor

gbracha commented May 3, 2012

Issue #398 has been merged into this issue.


cc @peter-ahe-google.

@gbracha
Copy link
Contributor

gbracha commented May 9, 2012

Fixed in 0.09 draft.


Added Done label.

@DartBot DartBot added Type-Defect area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). labels May 9, 2012
@DartBot DartBot added this to the M1 milestone May 9, 2012
pq added a commit that referenced this issue May 18, 2016
Adds:

* Fix to `public_member_api_docs` to check for documented getters when checking setters (#237).
* New `iterable_contains_unrelated_type` lint to detect when `Iterable.contains` is invoked with an object of an unrelated type.
* New `comment_references` lint to ensure identifiers referenced in docs are in scope (#240).

BUG=
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1993863002 .
copybara-service bot pushed a commit that referenced this issue May 9, 2023
…ion, convert, crypto, csslib, ffi, fixnum, glob, html, http_multi_server, http_parser, json_rpc_2, logging, mime, package_config, pool, pub_semver, source_map_stack_trace, sse, stack_trace, stream_channel, string_scanner, term_glyph, test_descriptor, tools, typed_data, web_socket_channel, webdev, yaml, yaml_edit

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

async (https://github.com/dart-lang/async/compare/b9ed219..0f368d3):
  0f368d3  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#240)

benchmark_harness (https://github.com/dart-lang/benchmark_harness/compare/e591ec4..f81b042):
  f81b042  2023-05-08  Devon Carew  Update pubspec.yaml (#89)
  1dc07da  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#88)

boolean_selector (https://github.com/dart-lang/boolean_selector/compare/9fd3bae..7eed402):
  7eed402  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#46)

clock (https://github.com/dart-lang/clock/compare/6b2004c..6b9df3e):
  6b9df3e  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#50)

collection (https://github.com/dart-lang/collection/compare/bf27520..6abff47):
  6abff47  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#282)

convert (https://github.com/dart-lang/convert/compare/855aeac..b652c00):
  b652c00  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#82)

crypto (https://github.com/dart-lang/crypto/compare/c5403c8..4e9dde1):
  4e9dde1  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#147)

csslib (https://github.com/dart-lang/csslib/compare/44bfbe3..923edf0):
  923edf0  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#178)

ffi (https://github.com/dart-lang/ffi/compare/6d8fa8d..1a859e0):
  1a859e0  2023-05-09  Michael Thomsen  Add topics in pubspec.yaml (#192)

fixnum (https://github.com/dart-lang/fixnum/compare/92ec336..006a130):
  006a130  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#111)

glob (https://github.com/dart-lang/glob/compare/eaa878b..46403be):
  46403be  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#76)

html (https://github.com/dart-lang/html/compare/5d87dc8..593d6f6):
  593d6f6  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#214)

http_multi_server (https://github.com/dart-lang/http_multi_server/compare/e0b5d35..d1fffed):
  d1fffed  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#54)

http_parser (https://github.com/dart-lang/http_parser/compare/bbe37dd..5a33f5f):
  5a33f5f  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#72)

json_rpc_2 (https://github.com/dart-lang/json_rpc_2/compare/5da2705..800843e):
  800843e  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#96)

logging (https://github.com/dart-lang/logging/compare/787030a..4779d7e):
  4779d7e  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#136)

mime (https://github.com/dart-lang/mime/compare/2d8496d..cd8001e):
  cd8001e  2023-05-09  Lara Schütt  Add `text/markdown` mimeType lookup by extension (#85)
  a0ea506  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#93)

package_config (https://github.com/dart-lang/package_config/compare/7e09db1..f41f92c):
  f41f92c  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#134)

pool (https://github.com/dart-lang/pool/compare/650e5d3..86b4f43):
  86b4f43  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#68)

pub_semver (https://github.com/dart-lang/pub_semver/compare/c3e56d1..6dd1908):
  6dd1908  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#85)

source_map_stack_trace (https://github.com/dart-lang/source_map_stack_trace/compare/08a81a8..09715f9):
  09715f9  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#38)

sse (https://github.com/dart-lang/sse/compare/f947c3d..11ba89e):
  11ba89e  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#83)

stack_trace (https://github.com/dart-lang/stack_trace/compare/9c1b1c5..36fa0e1):
  36fa0e1  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#130)

stream_channel (https://github.com/dart-lang/stream_channel/compare/71d4690..a862e41):
  a862e41  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#90)

string_scanner (https://github.com/dart-lang/string_scanner/compare/f7a656f..3bc6e54):
  3bc6e54  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#57)

term_glyph (https://github.com/dart-lang/term_glyph/compare/b110501..3de5f1b):
  3de5f1b  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#37)

test_descriptor (https://github.com/dart-lang/test_descriptor/compare/aa11162..23e49a2):
  23e49a2  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#51)

tools (https://github.com/dart-lang/tools/compare/6c68bca..62c9604):
  62c9604  2023-05-08  dependabot[bot]  Bump coverallsapp/github-action from 2.0.0 to 2.1.2 (#88)
  fde75bf  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#89)

typed_data (https://github.com/dart-lang/typed_data/compare/d85363d..021f25a):
  021f25a  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#64)

web_socket_channel (https://github.com/dart-lang/web_socket_channel/compare/b28bae6..2630714):
  2630714  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#265)

webdev (https://github.com/dart-lang/webdev/compare/12f2285..fe5b975):
  fe5b9758  2023-05-08  Anna Gringauze  Hide internal implementation details in type objects (#2103)

yaml (https://github.com/dart-lang/yaml/compare/54e8284..1f39ffe):
  1f39ffe  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#142)

yaml_edit (https://github.com/dart-lang/yaml_edit/compare/e05282b..763ca94):
  763ca94  2023-05-08  dependabot[bot]  Bump actions/checkout from 3.5.0 to 3.5.2 (#51)

Change-Id: Ie2414a72f1377775a474ef976c2f9c797ed5b0a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302360
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
copybara-service bot pushed a commit that referenced this issue Jan 8, 2024
matcher (https://github.com/dart-lang/matcher/compare/fcbd361..d9cf4f6):
  d9cf4f6  2024-01-01  dependabot[bot]  Bump actions/stale from 8.0.0 to 9.0.0 (#240)
  7ea9047  2023-12-13  Kevin Moore  Update test_api dependency, bump & fix lints, prepare release (#237)
  050fdda  2023-12-13  Kevin Moore  blast_repo fixes (#238)

mockito (https://github.com/dart-lang/mockito/compare/57a7c82..e15e000):
  e15e000  2023-12-14  Sam Rawlins  Bump mockito to 5.4.4
  a2a6566  2023-12-14  Copybara-Service  Merge pull request #726 from provokateurin:chore/deps/test_api-0.7
  bda332c  2023-12-14  jld3103  chore(deps): Allow test_api 0.7
  9bd6fb0  2023-12-12  Paul Berry  Remove mockito pre-null-safety tests.

test (https://github.com/dart-lang/test/compare/43ff5bf..846d73e):
  846d73ee  2024-01-01  dependabot[bot]  Bump actions/upload-artifact from 3.1.3 to 4.0.0 (#2165)
  0ab56790  2024-01-01  dependabot[bot]  Bump actions/stale from 8.0.0 to 9.0.0 (#2167)
  3b960c3e  2024-01-01  dependabot[bot]  Bump github/codeql-action from 2.22.8 to 3.22.12 (#2166)
  30543cae  2023-12-19  Nate Bosch  Add more logging around iframe startup (#2160)
  e56a5e22  2023-12-13  Jacob MacDonald  small cleanup in catch (#2159)
  15b39372  2023-12-13  Jacob MacDonald  handle missing package config files (#2158)
  9667cca8  2023-12-13  Jacob MacDonald  release test_api 7.0.0, test_core 6.0.0, and test 1.25.0 (#2156)
  b3fb1486  2023-12-13  Nate Bosch  Remove support for Internet Explorer (#2114)
  48a2bc3d  2023-12-13  Derek Xu  Update the package:vm_service constraint to allow version 14.x (#2157)

Change-Id: I386444652c47cd14a61665599d86dc3a7669a2fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345341
Reviewed-by: Nate Bosch <nbosch@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).
Projects
None yet
Development

No branches or pull requests

6 participants