-
Notifications
You must be signed in to change notification settings - Fork 570
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2813 from wbars/move-to-struct-init
Move to struct init intention: missed some parens-related cases
- Loading branch information
Showing
7 changed files
with
81 additions
and
6 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
11 changes: 11 additions & 0 deletions
11
testData/intentions/move-to-struct-initialization/fieldExtractedFromParens-after.go
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,11 @@ | ||
package main | ||
|
||
type S struct { | ||
foo string | ||
} | ||
|
||
func main() { | ||
s := S{foo: "bar"} | ||
|
||
print(s.foo) | ||
} |
11 changes: 11 additions & 0 deletions
11
testData/intentions/move-to-struct-initialization/fieldExtractedFromParens.go
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,11 @@ | ||
package main | ||
|
||
type S struct { | ||
foo string | ||
} | ||
|
||
func main() { | ||
s := S{} | ||
(s.foo) <caret>= "bar" | ||
print(s.foo) | ||
} |
15 changes: 15 additions & 0 deletions
15
testData/intentions/move-to-struct-initialization/justAssignedFieldParens.go
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,15 @@ | ||
package main | ||
|
||
type S struct { | ||
foo string | ||
bar string | ||
} | ||
|
||
func main() { | ||
var s S | ||
var str string | ||
s, (str) = S{}, "bar" | ||
s.foo, (s.bar)<caret> = "foo", ((str)) | ||
print(s.foo) | ||
print(str) | ||
} |
15 changes: 15 additions & 0 deletions
15
testData/intentions/move-to-struct-initialization/justAssignedVarBothParens.go
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,15 @@ | ||
package main | ||
|
||
type S struct { | ||
foo string | ||
bar string | ||
} | ||
|
||
func main() { | ||
var s S | ||
var str string | ||
s, (str) = S{}, "bar" | ||
s.foo, s.bar<caret> = "foo", ((str)) | ||
print(s.foo) | ||
print(str) | ||
} |
15 changes: 15 additions & 0 deletions
15
testData/intentions/move-to-struct-initialization/justAssignedVarWrongCaretWithParens.go
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,15 @@ | ||
package main | ||
|
||
type S struct { | ||
foo string | ||
bar string | ||
} | ||
|
||
func main() { | ||
var s S | ||
var str string | ||
s, str = S{}, "bar" | ||
s.foo, s.bar<caret> = "foo", ((str)) | ||
print(s.foo) | ||
print(str) | ||
} |
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