-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Correctly detect colon lambda eol indent for optional brace of argument #22477
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
Merged
som-snytt
merged 3 commits into
scala:main
from
som-snytt:issue/22193-indent-after-colon-arrow
Feb 7, 2025
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Permit indent at width after colon arrow eol
- Loading branch information
commit fb9bc69ce7a159131afc38fa6eb59ea26ab4dc63
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,44 @@ | ||
|
||
def fn2(arg: String, arg2: String)(f: String => Unit): Unit = f(arg) | ||
|
||
def fn3(arg: String, arg2: String)(f: => Unit): Unit = f | ||
|
||
def test1() = | ||
|
||
fn2(arg = "blue sleeps faster than tuesday", arg2 = "the quick brown fox jumped over the lazy dog"): env => | ||
val x = env | ||
som-snytt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
println(x) | ||
|
||
fn2( // error not a legal formal parameter for a function literal | ||
arg = "blue sleeps faster than tuesday", | ||
arg2 = "the quick brown fox jumped over the lazy dog"): env => | ||
val x = env // error | ||
println(x) | ||
|
||
fn2( // error | ||
arg = "blue sleeps faster than tuesday", | ||
arg2 = "the quick brown fox jumped over the lazy dog"): env => | ||
val x = env // error | ||
println(x) | ||
|
||
fn2( | ||
arg = "blue sleeps faster than tuesday", | ||
< 9E81 /td> | arg2 = "the quick brown fox jumped over the lazy dog"): | |
env => // error indented definitions expected, identifier env found | ||
val x = env | ||
println(x) | ||
|
||
def test2() = | ||
|
||
fn2( | ||
arg = "blue sleeps faster than tuesday", | ||
arg2 = "the quick brown fox jumped over the lazy dog" | ||
): env => | ||
val x = env | ||
println(x) | ||
|
||
fn3( // error missing argument list for value of type (=> Unit) => Unit | ||
arg = "blue sleeps faster than tuesday", | ||
arg2 = "the quick brown fox jumped over the lazy dog"): | ||
val x = "Hello" // error | ||
println(x) // error |
This file contains hidden or 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,57 @@ | ||
|
||
def fn2(arg: String, arg2: String)(f: String => Unit): Unit = f(arg) | ||
|
||
def fn3(arg: String, arg2: String)(f: => Unit): Unit = f | ||
|
||
def test() = | ||
|
||
fn2(arg = "blue sleeps faster than tuesday", arg2 = "the quick brown fox jumped over the lazy dog"): env => | ||
val x = env | ||
println(x) | ||
|
||
// doesn't compile | ||
som-snytt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
fn2( | ||
arg = "blue sleeps faster than tuesday", | ||
arg2 = "the quick brown fox jumped over the lazy dog"): env => | ||
val x = env | ||
println(x) | ||
|
||
fn2( | ||
arg = "blue sleeps faster than tuesday", | ||
arg2 = "the quick brown fox jumped over the lazy dog"): env => | ||
val x = env | ||
println(x) | ||
|
||
// does compile | ||
fn2( | ||
arg = "blue sleeps faster than tuesday", | ||
arg2 = "the quick brown fox jumped over the lazy dog"): | ||
env => | ||
val x = env | ||
println(x) | ||
|
||
// does compile | ||
fn2( | ||
arg = "blue sleeps faster than tuesday", | ||
arg2 = "the quick brown fox jumped over the lazy dog" | ||
): env => | ||
val x = env | ||
println(x) | ||
|
||
fn3( | ||
arg = "blue sleeps faster than tuesday", | ||
arg2 = "the quick brown fox jumped over the lazy dog"): | ||
val x = "Hello" | ||
println(x) | ||
|
||
fn3( | ||
arg = "blue sleeps faster than tuesday", | ||
arg2 = "the quick brown fox jumped over the lazy dog"): | ||
val x = "Hello" | ||
println(x) | ||
|
||
som-snytt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// don't turn innocent empty cases into functions | ||
def regress(x: Int) = | ||
x match | ||
case 42 => | ||
case _ => |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, I also don't like these end markers 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the method used to be longer and had a blank line. I must have deleted it during other edits while experimenting, but here it's no longer needed.