Skip to content

Commit 2b6afdf

Browse files
dsymeKevinRansom
authored andcommitted
[RFC FS-1054] less strict indentation on common DSL pattern (#4929)
* less strict indentation on common DSL pattern * missed one case * missing file * fix test
1 parent 4459532 commit 2b6afdf

File tree

3 files changed

+81
-2
lines changed

3 files changed

+81
-2
lines changed

src/fsharp/LexFilter.fs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,8 +669,11 @@ type LexFilterImpl (lightSyntaxStatus:LightSyntaxStatus, compilingFsLib, lexer,
669669
-> unindentationLimit false rest
670670

671671
// 'f ...{' places no limit until we hit a CtxtLetDecl etc...
672-
| _,(CtxtParen (LBRACE,_) :: CtxtVanilla _ :: CtxtSeqBlock _ :: rest)
673-
| _,(CtxtSeqBlock _ :: CtxtParen(LBRACE,_) :: CtxtVanilla _ :: CtxtSeqBlock _ :: rest)
672+
// 'f ...[' places no limit until we hit a CtxtLetDecl etc...
673+
// 'f ...[|' places no limit until we hit a CtxtLetDecl etc...
674+
| _,(CtxtParen ((LBRACE | LBRACK | LBRACK_BAR),_) :: CtxtSeqBlock _ :: rest)
675+
| _,(CtxtParen ((LBRACE | LBRACK | LBRACK_BAR),_) :: CtxtVanilla _ :: CtxtSeqBlock _ :: rest)
676+
| _,(CtxtSeqBlock _ :: CtxtParen((LBRACE | LBRACK | LBRACK_BAR),_) :: CtxtVanilla _ :: CtxtSeqBlock _ :: rest)
674677
-> unindentationLimit false rest
675678

676679

tests/fsharp/tests.fs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1824,6 +1824,12 @@ module TypecheckTests =
18241824
fsc cfg "%s --target:exe -o:pos29.exe" cfg.fsc_flags ["pos29.fsi"; "pos29.fs"; "pos29.app.fs"]
18251825
peverify cfg "pos29.exe"
18261826

1827+
[<Test>]
1828+
let ``sigs pos30`` () =
1829+
let cfg = testConfig "typecheck/sigs"
1830+
fsc cfg "%s --target:exe -o:pos30.exe --warnaserror+" cfg.fsc_flags ["pos30.fs"]
1831+
peverify cfg "pos30.exe"
1832+
18271833
[<Test>]
18281834
let ``sigs pos24`` () =
18291835
let cfg = testConfig "typecheck/sigs"
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
module Pos30
2+
3+
module Test0 =
4+
System.Console.WriteLine(format="{0}", arg = (Array.ofSeq <| seq {
5+
yield box "hello"
6+
}))
7+
8+
module Test0b =
9+
System.Console.WriteLine(seq {
10+
yield 1
11+
})
12+
13+
module Test1 =
14+
System.Console.WriteLine(format="{0}", arg = [|
15+
"hello"
16+
|])
17+
System.Console.WriteLine([|
18+
"hello"
19+
|])
20+
21+
module Test2 =
22+
System.Console.WriteLine(format="{0}", arg = Array.ofList [
23+
"hello"
24+
])
25+
System.Console.WriteLine([
26+
"hello"
27+
])
28+
29+
module Test3 =
30+
System.Console.WriteLine(format="{0}", arg = [|
31+
|])
32+
System.Console.WriteLine([|
33+
|])
34+
35+
36+
module Test4 =
37+
System.Console.WriteLine(format="{0}", arg = Array.ofList [
38+
])
39+
System.Console.WriteLine([
40+
])
41+
42+
module Test5 =
43+
System.Console.WriteLine(format="{0}", arg = [|
44+
yield box "hello"
45+
yield box "hello"
46+
yield box "hello"
47+
yield box "hello"
48+
|])
49+
50+
module Test6 =
51+
System.Console.WriteLine(format="{0}", arg = Array.ofList [
52+
yield box "hello"
53+
yield box "hello"
54+
yield box "hello"
55+
yield box "hello"
56+
yield box "hello"
57+
])
58+
59+
60+
module Test7 =
61+
System.Console.WriteLine [|
62+
yield "hello"
63+
yield "hello"
64+
yield "hello"
65+
yield "hello"
66+
yield "hello"
67+
|]
68+
69+
70+

0 commit comments

Comments
 (0)