Skip to content
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

[RFC FS-1070] relax indentations for static members and constructors #6314

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
31ee3a4
relax indentations
dsyme Mar 9, 2019
3fb2e72
fix baseline
dsyme Mar 9, 2019
d1b1389
add diagnostics
dsyme Mar 10, 2019
0f89711
add diagnostics
dsyme Mar 10, 2019
7da6aff
diagnostics
dsyme Mar 11, 2019
871489b
diagnostics
dsyme Mar 11, 2019
27d00a0
diagnostics
dsyme Mar 11, 2019
7d98d16
add diagnostics and possible fix for tp smoke tests
dsyme Mar 11, 2019
cc6e992
fix build
dsyme Mar 11, 2019
e13b385
fix build
dsyme Mar 11, 2019
8832b48
Merge branch 'diag4' into indents5
dsyme Mar 11, 2019
ce0961e
more diagnostics
dsyme Mar 11, 2019
2bb15ce
integrate master
dsyme Mar 11, 2019
5111d4e
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme Mar 11, 2019
51e2012
try to fix flaky test
dsyme Mar 12, 2019
1b12929
Update neg77.fsx
dsyme Mar 12, 2019
26e05dd
fix build
dsyme Mar 12, 2019
434810a
try to fix dodgy test
dsyme Mar 13, 2019
71f51b9
Merge branch 'diag4' into indents5
dsyme Mar 13, 2019
cbd1cf9
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme Mar 13, 2019
49ad748
Merge branch 'indents5' of https://github.com/dsyme/visualfsharp into…
dsyme Mar 13, 2019
9aad485
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme Mar 20, 2019
c921eff
Merge branch 'master' of https://github.com/Microsoft/visualfsharp in…
dsyme Mar 21, 2019
c6b1c8c
merge master
dsyme Mar 26, 2019
7b00422
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme Apr 1, 2019
44790ee
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme Apr 14, 2019
7651e86
Merge branch 'master' of http://github.com/Microsoft/visualfsharp int…
dsyme Apr 16, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/fsharp/LexFilter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,13 @@ type LexFilterImpl (lightSyntaxStatus: LightSyntaxStatus, compilingFsLib, lexer,
// 'type C = class ... ' limited by 'type'
// 'type C = interface ... ' limited by 'type'
// 'type C = struct ... ' limited by 'type'
| _, (CtxtParen ((CLASS | STRUCT | INTERFACE), _) :: CtxtSeqBlock _ :: (CtxtTypeDefns _ as limitCtxt) :: _)
| _, (CtxtParen ((CLASS | STRUCT | INTERFACE), _) :: CtxtSeqBlock _ :: (CtxtTypeDefns _ as limitCtxt) :: _)
// 'type C(' limited by 'type'
| _, (CtxtSeqBlock _ :: CtxtParen(LPAREN, _) :: (CtxtTypeDefns _ as limitCtxt) :: _ )
// 'static member C(' limited by 'static', likewise others
| _, (CtxtSeqBlock _ :: CtxtParen(LPAREN, _) :: (CtxtMemberHead _ as limitCtxt) :: _ )
// 'static member P with get() = ' limited by 'static', likewise others
| _, (CtxtWithAsLet _ :: (CtxtMemberHead _ as limitCtxt) :: _ )
-> PositionWithColumn(limitCtxt.StartPos, limitCtxt.StartCol + 1)

// REVIEW: document these
Expand All @@ -780,6 +786,7 @@ type LexFilterImpl (lightSyntaxStatus: LightSyntaxStatus, compilingFsLib, lexer,
// else expr
| (CtxtIf _ | CtxtElse _ | CtxtThen _), (CtxtIf _ as limitCtxt) :: _rest
-> PositionWithColumn(limitCtxt.StartPos, limitCtxt.StartCol)

// Permitted inner-construct precise block alignment:
// while ...
// do expr
Expand Down
12 changes: 12 additions & 0 deletions tests/fsharp/typecheck/sigs/neg77.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,15 @@ neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: th
neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (133:19). Try indenting this token further or using standard formatting conventions.

neg77.fsx(134,15,134,16): parse error FS0010: Unexpected symbol '|' in expression

neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions.

neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions.

neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions.
54 changes: 54 additions & 0 deletions tests/fsharp/typecheck/sigs/neg77.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,60 @@ do Application.Run(form)
#endif


open System

type OffsideCheck(a:int,
b:int, c:int, // no warning
d:int, e:int,
f:int) =
static member M(a:int,
b:int, c:int, // no warning
d:int, e:int,
f:int) = 1

module M =
type OffsideCheck(a:int,
b:int, c:int, // warning
d:int, e:int,
f:int) =
class end

module M2 =
type OffsideCheck() =
static member M(a:int,
b:int, c:int, // warning
d:int, e:int,
f:int) = 1

type C() =
static member P with get() =
1 // no warning

module M3 =
type C() =
static member P with get() =
1 // warning


type OffsideCheck2(a:int,
b:int, c:int, // no warning
d:int, e:int,
f:int) =
static member M(a:int,
b:int, c:int, // no warning
d:int, e:int,
f:int) = 1

type OffsideCheck3(a:int,
b:int, c:int, // no warning
d:int, e:int,
f:int) =
static member M(a:int,
b:int, c:int, // no warning
d:int, e:int,
f:int) = 1





Expand Down
24 changes: 24 additions & 0 deletions tests/fsharp/typecheck/sigs/neg77.vsbsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,34 @@ neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: th

neg77.fsx(134,15,134,16): parse error FS0010: Unexpected symbol '|' in expression

neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions.

neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions.

neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (133:19). Try indenting this token further or using standard formatting conventions.

neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (133:19). Try indenting this token further or using standard formatting conventions.

neg77.fsx(134,15,134,16): parse error FS0010: Unexpected symbol '|' in expression

neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions.

neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions.

neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions.

neg77.fsx(153,75,153,79): typecheck error FS0001: The type 'Planet * 'a' is not compatible with the type 'Planet'