You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,11 @@
1
1
# Changelog
2
2
3
+
## [Unreleased]
4
+
5
+
### Fixed
6
+
7
+
- Chained `?` operator accesses (e.g. `x?a("")?b(t)`) no longer add a space before parenthesised arguments, which previously changed how the next `?member` was parsed. Detected during AST→Oak transformation and represented as a new `Expr.DynamicChain` node so the printer can keep the chain tight; lone `?` calls still respect `SpaceBefore(Upper|Lower)caseInvocation`. [#3159](https://github.com/fsprojects/fantomas/issues/3159)
Copy file name to clipboardExpand all lines: src/Fantomas.Core.Tests/DynamicOperatorTests.fs
+18-4Lines changed: 18 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -88,13 +88,27 @@ let doc = x?a("")?b(t)?b(t)
88
88
|> should
89
89
equal
90
90
"""
91
-
let doc = x?a ("")?b (t)?b (t)
91
+
let doc = x?a("")?b(t)?b(t)
92
+
"""
93
+
94
+
[<Test>]
95
+
let``no space before paren args in dynamic operator chain,3159`` ()=
96
+
formatSourceString
97
+
"""
98
+
x?a("")?b(t)
99
+
"""
100
+
config
101
+
|> prepend newline
102
+
|> should
103
+
equal
104
+
"""
105
+
x?a("")?b(t)
92
106
"""
93
107
94
108
[<Test>]
95
109
let``case determination issue with ExprAppSingleParenArgNode uppercase with config lower,3088`` ()=
96
-
// We want to disobey SpaceBefore(Upper|Lower)caseInvocation inside of the ? chain because mixing it up can generate invalid code like x?a("arg")?B ("barg")?c("carg")
97
-
// The space config that is used (Upper or Lower) depends on the case of the dynamic object, here x
110
+
// Space before paren args of a `?` result is never added, regardless of SpaceBefore(Upper|Lower)caseInvocation.
111
+
// Adding a space changes the AST when followed by another `?`, e.g. `X?a ("arg")?B`. See #3159.
98
112
formatSourceString
99
113
"""
100
114
let doc1 = x?a("arg")?B("barg")?c("carg")
@@ -108,7 +122,7 @@ let doc2 = X?a("arg")?B("barg")?c("carg")
0 commit comments