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)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 32454 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

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