Skip to content

Unexpected keyword error when there's no keyword #10043

Closed

Description

@abelbraaksma

Basically just:

> let i:float`1 = 3.0;;
  let i:float`1 = 3.0;;
  -----------^
stdin(4,12): error FS0010: Unexpected reserved keyword in binding. Expected '=' or other token.

The backtick ` maybe reserved, but certainly isn't a keyword, right?

Same is true for the operator ~ (which normally serves as a prefix for other operators):

> let i:float~1 = 3.0;;
  let i:float~1 = 3.0;;
  -----------^
stdin(7,12): error FS0010: Unexpected reserved keyword in binding. Expected '=' or other token.

And this one is certainly surprising (! is an actual overridable operator), any future use in the plans? :)

> let i:float!1 = 3.0;;
  let i:float!1 = 3.0;;
  ------^^^^^^
stdin(8,7): error FS1141: Identifiers followed by '!' are reserved for future use

Note that if you use something more operator-like, you get a more useful message, which I think should be the message for the above ones as well, or just use wording like "reserved operator":

> let i:float@1 = 3.0;;
  let i:float@1 = 3.0;;
  -----------^
stdin(6,12): error FS0615: Unexpected infix operator in type expression

Activity

  1. added this to the Backlog milestone on Sep 1, 2020
  2. added
    Impact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.
    on Sep 1, 2020
  3. added
    Area-Diagnosticsmistakes and possible improvements to diagnostics
    and removed on Mar 31, 2022
  4. github-actions commented on Mar 22, 2026

    @github-actions
    Contributor

    🤖 This is an automated response from Repo Assist.

    This issue appears to be fixed in recent versions of the F# compiler. The misleading FS0010: Unexpected reserved keyword in binding message for backtick (`) and tilde (~) characters in type expressions has been replaced with the more accurate FS3563: This is not a valid identifier.

    Verified with current compiler:

    // Backtick: was FS0010 "Unexpected reserved keyword" → now FS3563 "This is not a valid identifier" ✅
    let i:float`1 = 3.0
    // → error FS3563: This is not a valid identifier
    
    // Tilde: was FS0010 "Unexpected reserved keyword" → now FS3563 "This is not a valid identifier" ✅  
    let i:float~1 = 3.0
    // → error FS3563: This is not a valid identifier
    
    // Exclamation: FS1141 "reserved for future use" — unchanged (still reasonable) ✅
    let i:float!1 = 3.0
    // → error FS1141: Identifiers followed by '!' are reserved for future use
    
    // At sign: FS0615 "Unexpected infix operator" — unchanged ✅
    let i:float@1 = 3.0
    // → error FS0615: Unexpected infix operator in type expression
    

    The error messages are now accurate and no longer mention "keyword" for non-keyword characters. Maintainer: please verify and close if confirmed.

    Generated by Repo Assist · ◷

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/repo-assist.md@9135cdfde26838a01779aa966628308404ec1f02
    
  5. auduchinok commented on Mar 23, 2026

    @auduchinok
    Member

    I can confirm the ~ and ` cases have been fixed in #15030.

  6. auduchinok commented on Mar 23, 2026

    @auduchinok
    Member

    @T-Gro I'm not sure about the ! and @ cases though! 🙂

  7. added 3 commits that reference this issue on Mar 24, 2026
  8. added 4 commits that reference this issue on Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    AI-thinks-issue-fixedArea-Diagnosticsmistakes and possible improvements to diagnosticsBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions