Skip to content

Unescaping f# method names #4972

Closed
Closed

Description

@nohwnd

Fancy f# method names with `` `` are escaping according to some rules, and to make managed name full compatible we need to fully unescape. #4969 fixes the most painful problem that prevents discovering completely. But in ideal case the CIL name should be fully unescaped so it can be found through reflection.


I have run a few manual tests and here are the characters that gets transformed (not exhaustive list):

  • \ escaped as \\
  • ' escaped as \'
  • " escaped as \"
  • @ escaped as @5

I will look at more cases now.

Originally posted by Amaury Levé (@Evangelink) in #4969 (comment)

AB#2020980

Activity

  1. testplatform-bot commented on Apr 9, 2024

    @testplatform-bot
    Contributor

    ✅ Successfully linked to Azure Boards work item(s):

  2. nohwnd commented on Apr 9, 2024

    @nohwnd
    MemberAuthor

    Spec says:
    3.4 Identifiers and Keywords

    Any sequence of characters that is enclosed in double-backtick marks ( ), excluding newlines,
    tabs, and double-backtick pairs themselves, is treated as an identifier. Note that when an identifier is
    used for the name of a types, union type case, module, or namespace, the following characters are
    not allowed even inside double-backtick marks:
    ‘.', '+', '$', '&', '[', ']', '/', '\', '*', '"', '`'
    All input files are currently assumed to be encoded as UTF-8. See the C# specification for a list of the
    Unicode characters that are accepted for the Unicode character classes \Lu, \Li, \Lt, \Lm, \Lo, \Nl,
    \Pc, \Mn, \Mc, and \Cf.

    https://fsharp.org/specs/language-spec/4.1/[FSharpSpec-4.1-latest.pdf](https://fsharp.org/specs/language-spec/4.1/FSharpSpec-4.1-latest.pdf)

    member this.`` . + - = $ & [ ] \ / * @ ' ` " % ( ) ^ `` () =
    Experimenting with the chars above and few more only ` ' " \ look to be escaped for methods:

    image

    Amaury Bouchard (@Amaury) how did you get @ to become Yuriy Semchyshyn (@5)?

  3. Amaury commented on Apr 9, 2024

    @Amaury

    Not the right Amaury... Try again 😉

  4. nohwnd commented on Apr 11, 2024

    @nohwnd
    MemberAuthor

    This is not an issue, I misinterpreted what the parser is doing. We only need to handle ' correctly, which we do in #4969

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions