Bug 32454 - FSharp interactive -- Map.add crashes with a record key and DU as a value
Summary: FSharp interactive -- Map.add crashes with a record key and DU as a value
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: 4.0.0
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-07-26 07:38 UTC by Geoffrey King
Modified: 2017-08-28 23:01 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Geoffrey King 2015-07-26 07:38:29 UTC
Fails when run from in the REPL/interacive with a core dump.

Works when compiled (and an entrypoint added)

Running on:
Mono JIT compiler version 4.0.2 (Stable 4.0.2.5/c99aa0c Wed Jun 24 10:04:37 UTC 2015)
FSharp 3.1
Ubuntu 14.04

// This code causes a core dump.
// The types of key & value passed to Map.add seem to be the triggers.
// If primitive types are used it doesn't crash
type Cell =
  | Int of int
  | Float of float

type CellRef = {
  Col   : int
  Row   : int
  }

let cref c r = {
  Col = c
  Row = r
  }

let folding sheet =
  let initialRange = {Col=0;Row=1}
  let update cref range = range

  Map.fold (fun range cref cell -> update cref range) initialRange sheet

let evil () =
  Map.empty
  |> Map.add (cref 10 9) (Int 7)
  |> folding

Note You need to log in before you can comment on or make changes to this bug.