Skip to content

Add KeywordString to SynConst type #11477

@nojaf

Description

@nojaf

Is your feature request related to a problem? Please describe.

Any original keyword string (__LINE__, __SOURCE_DIRECTORY__ or __SOURCE_FILE__) information is currently lost in the untyped tree.

They are represented as SynConst.String with the resolved values.

__LINE__

leads to

Const(String ("1", tmp.fsx (1,0--1,8) IsSynthetic=false), tmp.fsx (1,0--1,8) IsSynthetic=false),

Describe the solution you'd like
I propose to extend SynConst with a new union case | KeywordString of constant: string * value: string * range: Range.

Describe alternatives you've considered
Get the original keyword from the F# tokens.

Additional context

This would lead to a richer AST and would be one less check Fantomas has to do to restore the original typed value.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions