Skip to content

Range of SynPat.Named doesn't include accessibility #13115

@Booksbaum

Description

@Booksbaum

SynPat.Named(range=range) -> range doesn't include accessibility modifier (public, internal,public)

Repro steps

let private value = 42
//  ^^^^^^^^^^^^^ SynPat.Named(ident="value"; accessibility=Some(Private))
//          ^^^^^ range of SynPat.Named

Ast:

Named(
  SynIdent (value, None),
  false,
  Some Private,
  tmp.fsx (1,12-1,17)
)

-> Range covers columns 12 to 17 -> just value but not private

Expected behavior

Range of SynPat.Named includes private

Actual behavior

Range just covers identifier

Known workarounds

None?

SynAccess doesn't provide its range -> cannot combine ranges of elements inside SynPat.Named to get full range.

Maybe possible to infer by looking at parent and its SynPat.Named hole?
Or via source text: extract word in front of Named/its ident

Related information

SynPat.LongIdent includes SynAccess range:

let (private Some _) = None
//   ^^^^^^^^^^^^^^ SynPat.LongIdent
//   ^^^^^^^^^^^^^^ range of SynPat.LongIdent

(AST)



  • dotnet --version: 6.0.202
  • FCS: 41.0.4-preview.22181.2 & 41.0.3 & current dotnet/fsharp main branch (91fb779)

Metadata

Metadata

Assignees

Labels

Area-LangService-APIBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.

Type

No fields configured for Bug.

Projects

Status

New

Relationships

None yet

Development

No branches or pull requests

Issue actions