diff --git a/src/fsharp/LexFilter.fs b/src/fsharp/LexFilter.fs index 7cfdbcf494a..a125a64d7bf 100755 --- a/src/fsharp/LexFilter.fs +++ b/src/fsharp/LexFilter.fs @@ -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 @@ -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 diff --git a/tests/fsharp/typecheck/sigs/neg77.bsl b/tests/fsharp/typecheck/sigs/neg77.bsl index 922e6b66950..3598ff0c935 100644 --- a/tests/fsharp/typecheck/sigs/neg77.bsl +++ b/tests/fsharp/typecheck/sigs/neg77.bsl @@ -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. diff --git a/tests/fsharp/typecheck/sigs/neg77.fsx b/tests/fsharp/typecheck/sigs/neg77.fsx index c354321cde8..2f38101f2d6 100644 --- a/tests/fsharp/typecheck/sigs/neg77.fsx +++ b/tests/fsharp/typecheck/sigs/neg77.fsx @@ -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 + + diff --git a/tests/fsharp/typecheck/sigs/neg77.vsbsl b/tests/fsharp/typecheck/sigs/neg77.vsbsl index 44832298057..32adc1f3b96 100644 --- a/tests/fsharp/typecheck/sigs/neg77.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg77.vsbsl @@ -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'