Skip to content

F~ Comment Highlight bug #2696

@martinfreedman

Description

@martinfreedman

Information:
-latest version of testdrive
https://prismjs.com/test.html#language=fsharp

Description
n F#, it is idiomatic to convert the multiplier operator to a function (*)

This causes a problem with the F# syntax highlighter, which sees (*... ..*) as a muilti-line comment, but it is is not when using (*) as seen in this screenshot from my solution.

Example
When I post this into testdrive:

let score category (dice:Die list) = 
    let iDice = dice |> List.map int |> List.sortDescending
    let diced = iDice |> List.countBy id |> List.sortByDescending snd 
    let countScore cat = dice |> List.filter (fun d -> d=cat) |> List.length |> (*) (int cat)
    let isStraight = iDice.[0] - iDice.[4] = 4

    match category  , List.map snd diced  with
    | Yacht         , [5]         -> 50
    | Ones          , _           -> countScore Die.One  
    | Twos          , _           -> countScore Die.Two  
    | Threes        , _           -> countScore Die.Three 
    | Fours         , _           -> countScore Die.Four 
    | Fives         , _           -> countScore Die.Five 
    | Sixes         , _           -> countScore Die.Six       
    | FourOfAKind   , [4;1]       
    | FourOfAKind   , [5]         -> iDice |> List.head |> (*) 4
    | LittleStraight, [1;1;1;1;1] when isStraight && iDice.[0] = 5 -> 30 
    | BigStraight   , [1;1;1;1;1] when isStraight && iDice.[0] = 6 -> 30
    | FullHouse     , [3;2]           
    | Choice        , _           -> iDice |> List.sum           
    | _             , _           -> 0

the screenshot is:

image

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