-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warn if an interpolated identifier is followed by -. (#1375)
- Loading branch information
Showing
4 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
tests/negative/minus_interpolated_test.toit:9:11: warning: Interpolated identifiers followed by '-' must be parenthesized | ||
print "$foo-b" // Warning, since that would become a single identifier. | ||
^~~ | ||
tests/negative/minus_interpolated_test.toit:10:11: warning: Interpolated identifiers followed by '-' must be parenthesized | ||
print "$foo-3" // Same warning. | ||
^~~ | ||
tests/negative/minus_interpolated_test.toit:12:3: error: Unresolved identifier: 'unresolved' | ||
unresolved | ||
^~~~~~~~~~ | ||
Compilation failed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (C) 2023 Toitware ApS. | ||
// Use of this source code is governed by a Zero-Clause BSD license that can | ||
// be found in the tests/LICENSE file. | ||
main: | ||
foo := 499 | ||
bar := 42 | ||
print "$foo-" // OK because not followed by identifier character. | ||
print "$foo-b" // Warning, since that would become a single identifier. | ||
print "$foo-3" // Same warning. | ||
print "$foo-$bar" // OK. | ||
unresolved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters