Skip to content

Commit 18bd7c3

Browse files
committed
Parser: recover on missing interface members
1 parent c00299f commit 18bd7c3

4 files changed

Lines changed: 53 additions & 0 deletions

File tree

docs/release-notes/.FSharp.Compiler.Service/11.0.100.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
* Fix dot-completion after indexed expressions (`a.[0].Data.`, `a[0].Data.`, `[1;2].Length.`) returning unrelated global completions instead of expression-typings members. ([Issue #4966](https://github.com/dotnet/fsharp/issues/4966), [PR #19934](https://github.com/dotnet/fsharp/pull/19934))
130130
* Quotations of `match s with "" -> _` no longer leak the `s <> null && s.Length = 0` lowering; the empty-string optimization moved from pattern-match compilation to the optimizer so quoted expressions keep `op_Equality(s, "")`. ([Issue #19873](https://github.com/dotnet/fsharp/issues/19873))
131131
* Fix #5795: Allow attributes defined in a `module rec` / `namespace rec` scope to be used on union cases, record fields, and generic type parameters of types in the same recursive scope. ([Issue #5795](https://github.com/dotnet/fsharp/issues/5795), [PR #19744](https://github.com/dotnet/fsharp/pull/19744))
132+
* Parser: recover on missing interface members ([PR #20105](https://github.com/dotnet/fsharp/pull/20105))
132133

133134
### Added
134135

src/Compiler/pars.fsy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2313,6 +2313,10 @@ opt_interfaceImplDefn:
23132313
{ let mWithKwd = rhs parseState 1
23142314
Some(mWithKwd, [], mWithKwd) }
23152315

2316+
| OWITH recover
2317+
{ let mWithKwd = rhs parseState 1
2318+
Some(mWithKwd, [], mWithKwd) }
2319+
23162320
| /* EMPTY */
23172321
{ None }
23182322

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Module
2+
3+
type T =
4+
interface I with [<Attr>]
5+
6+
let f () = ()
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
ImplFile
2+
(ParsedImplFileInput
3+
("/root/Member/Interface 11.fs", false, QualifiedNameOfFile Module, [],
4+
[SynModuleOrNamespace
5+
([Module], false, NamedModule,
6+
[Types
7+
([SynTypeDefn
8+
(SynComponentInfo
9+
([], None, [], [T],
10+
PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector),
11+
false, None, (3,5--3,6)),
12+
ObjectModel
13+
(Unspecified,
14+
[Interface
15+
(LongIdent (SynLongIdent ([I], [], [None])),
16+
Some (4,16--4,20), Some [], (4,4--4,20))], (4,4--4,20)),
17+
[], None, (3,5--4,20), { LeadingKeyword = Type (3,0--3,4)
18+
EqualsRange = Some (3,7--3,8)
19+
WithKeyword = None })], (3,0--4,20));
20+
Let
21+
(false,
22+
[SynBinding
23+
(None, Normal, false, false, [],
24+
PreXmlDoc ((6,0), FSharp.Compiler.Xml.XmlDocCollector),
25+
SynValData
26+
(None, SynValInfo ([[]], SynArgInfo ([], false, None)), None),
27+
LongIdent
28+
(SynLongIdent ([f], [], [None]), None, None,
29+
Pats [Paren (Const (Unit, (6,6--6,8)), (6,6--6,8))], None,
30+
(6,4--6,8)), None, Const (Unit, (6,11--6,13)), (6,4--6,8),
31+
NoneAtLet, { LeadingKeyword = Let (6,0--6,3)
32+
InlineKeyword = None
33+
EqualsRange = Some (6,9--6,10) })], (6,0--6,13),
34+
{ InKeyword = None })],
35+
PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None,
36+
(1,0--6,13), { LeadingKeyword = Module (1,0--1,6) })], (true, true),
37+
{ ConditionalDirectives = []
38+
WarnDirectives = []
39+
CodeComments = [] }, set []))
40+
41+
(4,21)-(4,23) parse error Unexpected symbol '[<' in member definition
42+
(6,0)-(6,3) parse error Incomplete structured construct at or before this point in member definition

0 commit comments

Comments
 (0)